
This Excel VBA tutorial explains how to declare private variable, global variable / public variable in VBA, and explain the scope of variable.
You may also want to read:
Function, Sub, Method, Property
Difference between Dim and Set
Scope of local variable / global variable / private variable
Procedure Level
When you declare a variable inside a Sub Procedure or Function (local variable), the variable can only be used within them.
For example, in Sub Procedure1, you have declared...
Read More