0% found this document useful (0 votes)
53 views

VBA Data Type Summary

VBA supports several intrinsic data types including Boolean, Byte, Currency, Date, Decimal, Double, Integer, Long, String, and Variant. Each data type has an associated storage size and value range. For example, a Boolean uses 2 bytes and can be either True or False, while a Date uses 8 bytes and ranges from January 1, 100 to December 31, 9999. User-defined types can also be created to hold custom data.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views

VBA Data Type Summary

VBA supports several intrinsic data types including Boolean, Byte, Currency, Date, Decimal, Double, Integer, Long, String, and Variant. Each data type has an associated storage size and value range. For example, a Boolean uses 2 bytes and can be either True or False, while a Date uses 8 bytes and ranges from January 1, 100 to December 31, 9999. User-defined types can also be created to hold custom data.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

VBA data type summary

A data type is the characteristic of a variable that determines what kind of data it can hold. Data types
include those in the following table as well as user-defined types and specific types of objects.
Set intrinsic data types

The following table shows the supported data types, including storage sizes and ranges.

Data type Storage size Range

Boolean 2 bytes True or False

Byte 1 byte 0 to 255

Collection Unknown Unknown

-922,337,203,685,477.5808 to
Currency (scaled integer) 8 bytes
922,337,203,685,477.5807

Date 8 bytes January 1, 100, to December 31, 9999

+/-
79,228,162,514,264,337,593,543,950,335
with no decimal point

Decimal 14 bytes +/-7.9228162514264337593543950335


with 28 places to the right of the decimal

Smallest non-zero number is+/-


0.0000000000000000000000000001

Dictionary Unknown Unknown

-1.79769313486231E308 to -
4.94065645841247E-324 for negative values
Double (double-precision
8 bytes
floating-point)
4.94065645841247E-324 to
1.79769313486232E308 for positive values

Integer 2 bytes -32,768 to 32,767

Long (Long integer) 4 bytes -2,147,483,648 to 2,147,483,647

-9,223,372,036,854,775,808 to
9,223,372,036,854,775,807
LongLong (LongLong integer) 8 bytes
Valid on 64-bit platforms only.
Data type Storage size Range

-2,147,483,648 to 2,147,483,647 on 32-bit


4 bytes on 32-bit
systems
LongPtr (Long integer on 32-bit systems
systems, LongLong integer on
-9,223,372,036,854,775,808 to
64-bit systems) 8 bytes on 64-bit
9,223,372,036,854,775,807 on 64-bit
systems
systems

Object 4 bytes Any Object reference

-3.402823E38 to -1.401298E-45 for negative


values
Single (single-precision floating-
4 bytes
point)
1.401298E-45 to 3.402823E38 for positive
values

10 bytes + string
String (variable-length) 0 to approximately 2 billion
length

String (fixed-length) Length of string 1 to approximately 65,400

Any numeric value up to the range of


Variant (with numbers) 16 bytes
a Double

22 bytes + string
Variant (with characters) length (24 bytes Same range as for variable-length String
on 64-bit systems)

Number required The range of each element is the same as


User-defined (using Type)
by elements the range of its data type.

You might also like