Declaring variables means naming the variable and specifying their data types, that is declaration statements establish our project’s variables and constants give them names, and specify the data type they will hold.
These declaration statements are not considered as executable ; that is, they are not executed in flow of instructions during program execution.
Although these are several ways of declaring the variables, the most commonly used way is the Dim statements with the data type. We can omit the data type, then default data type becomes variant.
Here are some sample examples for declaration statement :
Dim strName as String ‘Declared the String variable
Dim intCount as Integer ‘Declared an Integer variable
Dim curDiscount as Currency ‘Declared a currency variable.