Why a is long and not integer? Ps. The amount of data shouldnt be more than 2000
Long and Integer are the same except that Long can deal with bigger numbers
from the
horse's mouth Three data types in VBA can represent integers, or whole numbers: the
Integer,
Long, and
Byte data types. Of these, the
Integer and
Long types are the ones you're most likely to use regularly.
The
Integer and
Long data types can both hold positive or negative values. The difference between them is their size:
Integer variables can hold values between -32,768 and 32,767, while
Long variables can range from -2,147,483,648 to 2,147,483,647. Traditionally, VBA programmers have used integers to hold small numbers, because they required less memory.
In recent versions, however, VBA converts all integer values to type Long, even if they're declared as type Integer. So there's no longer a performance advantage to using Integer variables; in fact, Long variables may be slightly faster because VBA does not have to convert them.
The
Byte data type can hold positive values from 0 to 255. A
Byte variable requires only a single byte of memory, so it's very efficient. You can use a
Byte variable to hold an
Integer value if you know that value will never be greater than 255. However, the
Byte data type is typically used for working with strings. For some string operations, converting the string to an array of bytes can significantly enhance performance.