VBA Currency Data Type in Excel 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 contains 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, monetary 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(@).
Syntax of the Currency Data Type 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 Data Types
Also read about all other 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
Thanks for the great info! Looking forward to more updates on this.