VBA Currency Data Type in Excel

Currency Data Type in Excel VBA

Currency Data Type in Excel VBA explained with syntax and examples. We use the Currency VBA data type to store numbers in integer format and these numbers scaled by 10,000. The default value is 0. The Currency VBA data type conatins range of values between -922,337,203,685,477.5808 to 922,337,203,685,477.5807. The data type Currency can be used store both positive and negative numbers. It is one of the VBA data type and occupies 8 bytes(64 bits) in memory.

Note: The currency VBA data type is useful for money, monetaory or fixed-point calculations. It has type declaration character. It is nothing but character appended to a variable instead of data type. The type declaration character for currency VBA data type is the explanation point(@).

Data Type Currency Syntax in Excel VBA

Let us see Data Type Currency Syntax in Excel VBA.

Dim VariableName as Currency

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

Example on the Currency VBA Data Type in Excel

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

Sub VBAF1_Currency_DataType2()
    
    'Integer Variable Declaration
    Dim cValue As Currency
    
    'Assign value to currency variable
    cValue = 888866664444.2222@
        
End Sub

Convert an Expression to Currency Data Type in Excel VBA

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

VBA CCur 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 *