This might help you
In VBA there are three levels of scope.
Local: the variable is declared inside a Sub or Function, using the Dim or Static keyword and is only availible inside that procedure.
Code:
Sub myRtn()
Dim myVariable as Variant
...
Module-wide: the variable is declared at the beginning of the module with the Dim keyword. it is available ot all procedures in that module, but not to procedures in other modules
Code:
Dim myModVariable as String
Sub myFirstProceedure
...
Public - the variable is declared at the beginning of a normal module with the Public key word. It is avaliable to all procedures is all modules of that project. (Variables declared with Public in Class, Userform and Object code modules have specialized meanings.)
Code:
Public myPublicVariable as String
Sub myFirstProceedure
...
Global is not a VBA reserved word. There are no (uppercase) Global variables in VBA. "global" is a term in the meta-language of programming, not in the programming language VBA
Bookmarks