While programming in VBA sometimes you need to declare a Public Variable that can store the value throughout the program.
Use of Public Variable: Let’s say you have 4 different Functions in your VBA Code or Module and you have a variable that may or may not be modified in any of the Functions during the execution. But whenever you want to use that variable, you want to latest value. In such a case Public Variable is useful.
Public Variable must be defined under any Module. It can be defined under any Sheet Code. See the Syntax below:
0 Comments