This Blog Post explain you data types in excel macro. Whenever macro code accept input from user or when you assign value to a variable, you need to define type of data to be store in a variable. for example :

          dim hindi, eng, math as integer.

Here hindi, eng, math is a variable and integer is a data type in excel macro.


Data Types In Excel Macro ( VBA )

Types

Size in Bytes

Description

Boolean
2 Store a value of True(0) or False(-1).
Byte
1 Contains a Number in the range of 0-255.
Currency
8 Define monetary values in the range of -922,337,203,608,477,5808 To 922,337,203,685,477,5807.
Date
8 Define Combination value that includes both dates and time although you certainly don’t have include both,valid dates range from January,1,100 to December 31,9999.
Double
8 Contains a real number in the range of-1.796313486231 E 308 +0-4.940 656458412437 e-324 for negative value of 4.94065645841247 E-324 to 1.79769313486232 e308 for positive values.
Integer
2 Contains a number in the range of-32,768 to 32-767
Long
4 Contains a number in the range of-2,147,483,648 to 2,147,483,647
Objects
4 Any objects references.
Single
4 Contains a real number in the range of-1.401298 E-45 for negative values and 1.401298 E-45 to 3.402823 E-38 for positive values
variant
16 Stores any valid numeric data type up to the size of a double.
Data Types in Excel Macro

Leave a Reply

Your email address will not be published. Required fields are marked *