Vba variables list
- how to declare variable in vba
- how to declare global variable in vba
- how to declare array variable in vba
- how to declare multiple variables in vba
Vba declare array
Vba global variable.
Declaring variables
When declaring variables, you usually use a Dim statement. A declaration statement can be placed within a procedure to create a procedure-level variable.
Or it may be placed at the top of a module, in the Declarations section, to create a module-level variable.
The following example creates the variable and specifies the String data type.
If this statement appears within a procedure, the variable can be used only in that procedure.
If the statement appears in the Declarations section of the module, the variable is available to all procedures within the module, but not to procedures in other modules in the project.
To make this variable available to all procedures in the project, precede it with the Public statement, as in the following example:
For information about naming your variables, see Visual Basic naming rules.
Variables can be declared as one of the following data types: Boolean, Byte, Integer, Long, Currency, Single, Double, Date, String (for variable-length strings), String * length (for fixed-length strings), Object
- how to declare a worksheet variable in vba
- how to define public variable in vba