Search notes:

VBA: global variables

At module-level, a variable can be declared using the global statement. Such a variable is accessible from other modules as well:
option explicit

global g_foo as long

sub doSomething
    …
end sub

…
The value of a global variable is not destroyed when a program ends normally. However, the end statement destroys global variables, see here.

See also

Variables in VBA

Index