Using the Variant as a General “Numeric” Data Type

Don’t get sidetracked by irrelevant machine-specific details. Almost all the time, we want to deal with numbers. For example, consider your thought process when you choose between declaring a variable to be of type integer or type long. You might consider what the likely values of the variable are going to be, worry a little bit about the effect on performance or memory usage, and maybe check to see how you declared a similar variable somewhere else so that you can be consistent. Save time. Get into the habit of declaring all these variables as Variants.

Note All variables in my code are either Variants or references to classes. Consequently, a lot of code starts to look like this:

Dim Top As Variant
Dim Left As Variant
Dim Width As Variant
Dim Height As Variant

After a time, I started to take advantage of the fact that Variants are the default, so my code now typically looks like this:

Dim Top, Left, Width, Height

I see no problem with this, but your current Visual Basic coding standards will more than likely prohibit it. You might think about changing them.