Double Data Type in Excel VBA

VBA Double Data Type in Excel

Double Data Type in Excel VBA

Double Data Type in Excel VBA explained with syntax and examples.Double Data Type in Excel VBA explained with syntax and examples. We use VBA data type Double to store numbers which represents Double-precision floating-point variables. The default value is 0 and store decimal values. The VBA data type Double conatins range of values -1.79769313486231E308 to -4.94065645841247E-324 for negative values, and 4.94065645841247E-324 to 1.79769313486232E308 for positive values.It is one of the VBA data type. It occupies 8 bytes(64 bits) in memory.

Note: It has type declaration character. It is nothing but character appended to a variable instead of data type. The type declaration character for single VBA data type is the explanation point(#).

Data Type Double Syntax in Excel VBA

Let us see Data Type Double Syntax in Excel VBA.

Dim VariableName as Double
'or
Dim VariableName#

Where VariableName represents the name of the variable.
and Double represents the type of data.

Example on the Data Type Double in Excel VBA

Here is an example on the Data Type Double in Excel VBA.

Sub VBAF1_Double_DataType()
    
    'Integer Variable Declaration
    Dim iValue As Double
       
    iValue = 1.1
     
End Sub

Convert an Expression to Double Data Type in Excel VBA

You can convert an expression to Double VBA data type using VBA CDbl function. Click on the following link to learn about CDbl function and complete tutorial and examples.

VBA CDbl Function

VBA Data Types

Also read about all other data types.

VBA Data Types

Leave a Comment

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