Dim VBA – Declare Variable

Associated Files Download Links

The Dim Keyword in VBA

You can use the Dim keyword in order to declare a variable in VBA:

Dim stands for Dimension. When you use the Dim keyword, state the name and data type of the new variable.

This is shown in the code below:

We have declared five different variables in the above code, and used five different data types. You can learn more about how to name variables and variable data types in our VBA Data Types – Variables and Constants tutorial where we go into detail about what variables are, how to name them and the different data types available in VBA.

[yuzo]