VBA Example of Declaring a Variable With Data Types
Let's see one example of how to declare variables using data types.
In the above example, I have declared variable data type as Integer data type, it uses 4 bytes storage and can be used for the value between -32,768 to 32,767.
If you do not declare the data type of the variable, it uses 16 bytes storage and it leads to a delay in running the code.
Related: Excel VBA common basic questions
Related: How to Record, Run and Save Macro
Related: VBA Data Types of Variables
Written by: Kalpesh Agrawal (Actuarial Intern - IIB)