'How can i call a variable from another Module in Excel Macro

For example;

I have two Modules, as Module1 and Module2

There are commands as follows in Module1

   For i = 2 to 1000

And i want to use same "i" variable in Module2.

How can i call the "i" variable from the Module1

Thanx



Solution 1:[1]

Hi very simple this way use declare in module1

Option Explicit
Public i As Integer

after that you can access other modules i variable value

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ike