VBA's DATA TYPES


The manner in which a program stores data in memory is referred to as the data type.

Examples of data types are integers, floating point numbers, and strings.

Although VBA can handle your data automatically without worrying about the data types, the resulting program executes very slowly and uses memory inefficiently.

This is certainly not acceptable except for very small and simple programs.

VBA has the following built-in data types:

VBA's Built-in Data Types
Data Type Bytes Used Range of Values
Boolean 2 true or False
Integer 2 -32,768 to 32767
Long 4 -2,147,483,648 to 2,147,483,647
Single 4 -3.402823E38 to 1.401298E45
Double (negative) 8 -1.79769313486232E308 to -4.94065645841247E-324
Double (positive) 8 4.94065645841247E-324 to 1.79769313486232E308
Currency 8 -922,337,203,685,477.5808 to 922,337,203,685,477.5807
Date 8 1/1/100 to 12/31/9999
String 1 per character Varies according to the number of characters
Object 4 Any defined object
Variant Varies Any data type
Used defined Varies Varies