This page describes how to
You can click here to download the file for this page.
You can click here to download a file containing the sample code.
Declaring Multiple Variables in One Line
Rather than using a separate line for each variable, you can declare multiple variables in the same line:
You can write a comma-separated list of variable names and data types in one Dim statement.
You may find this style of declaring variables convenient when you have a group of related variables. Take care to always state the data type for each variable that you declare. The code shown below falls into the trap of adding the data type only at the end of the line:
This code looks as though it declares three variables with the Double data type, but it doesn't! Only the last variable, BMI, has the Double data type. The other two variables will automatically have the Variant data type assigned to them.
You can learn more about the Variant data type