VBA Data Types in Excel VBA

VBA Data Types in Excel

VBA data types in Excel VBA. These are divided into two categories. The first one is numeric data type and other one is non-numeric data type.

VBA Numeric and Non-numeric Data Types in Excel

Here are the VBA Numeric and Non-numeric Data Types in Excel.

Numeric Data Type Non-Numeric Data Type
Byte String(Fixed Length)
Integer String(Variable Length)
Long Date
Single Boolean
Double Object
Currency Variant(Numbers)
Decimal Variant(Characters)

VBA Data Types and Size(Range of Values) in Excel

Let us see the complete details of VBA data types, its memory size, range of values, VBA constant, and its default value.

Data Type Bytes Used in Memory Range of Values Default Value VBA Constant
Byte 1 byte (8 bits) 0 to 255 0 vbByte
Boolean 2 bytes (16 bits) True or False FALSE vbBoolean
Integer 2 bytes (16 bits) -32,768 to 32,767 0 vbInteger
Long (long integer) 4 bytes (32 bits) -2,147,483,648 to 2,147,483,647 0  
LongLong (LongLong integer) 8 bytes (64 bits) -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 0 vbLong
Single 4 bytes (32 bits) -3.402823E38 to -1.401298E-45 for negative values; 1.401298E-45 to 3.402823E38 for positive values 0 vbSingle
Double 8 bytes (64 bits) -1.79769313486231E308 to-4.94065645841247E-324 for negative values; 4.94065645841247E-324 to 1.79769313486232E308 for positive values 0 vbDouble
Currency 8 bytes (64 bits) -922,337,203,685,477.5808 to 922,337,203,685,477.5807 0 vbCurrency
Decimal 14 bytes (112 bits) +/-79,228,162,514,264,337,593,543,950,335 with no decimal point;+/-7.9228162514264337593543950335 with 28 places to the right of the decimal   vbDecimal
Date 8 bytes (64 bits) January 1, 100 to December 31, 9999 0:00:00 vbDate
Object 4 bytes (32 bits) Any Object Reference Nothing vbObject
String (variable length) 10 bytes (80 bits) + string length 0 to ~2 billion characters “” vbString
String (fixed length) Length of string 1 to ~65,400 characters “” vbString
Variant (numbers) 16 bytes (128 bits) Any numeric value as large as Double Empty vbVariant
Variant (characters) 22 bytes (176 bits) + string length Same as variant variable-length String Empty vbVariant

Instructions to Run VBA Macro Code or Procedure:

You can refer the following link for the step by step instructions.

Instructions to run VBA Macro Code

Other Useful Resources:

Click on the following links of the useful resources. These helps to learn and gain more knowledge.

VBA Tutorial VBA Functions List VBA Arrays VBA Text Files VBA Tables

VBA Editor Keyboard Shortcut Keys List VBA Interview Questions & Answers Blog

Leave a Comment