Variable is a named memory location used to hold a value that can be changed during the script execution. Following are the basic rules for naming a variable.
- You must use a letter as the first character.
- You can’t use a space, period (.), exclamation mark (!), or the characters @, &, $, # in the name.
- Name can’t exceed 255 characters in length.
- You cannot use Visual Basic reserved keywords as variable name.
Syntax
In VBA, you need to declare the variables before using them.
Dim <<variable_name>> As <<variable_type>>