Although you may find it convenient to use Variant variables in your code, Visual Basic requires more time to process a value stored in a Variant variable than it needs to process a value stored in a variable declared with an explicit data type. Your code can perform mathematical computations that don't involve fractional values faster if you use Integer or Long variables rather than Variant variables. Integer or Long variables are also the best choice for the index variable in For...Next loops. The speed you gain using explicit variable types can come at the expense of flexibility. For example, when using explicit data types, you may encounter cases of overflow that Variant variables handle automatically.
For more information about data types, see Chapter 2, "Variables, Constants, and Data Types."