VBA Double Data Type in Excel

VBA Double Data Type in Excel

VBA Double Data Type in Excel 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 contains 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(#).

Syntax of the Double Data Type 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

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