Last Updated on January 11, 2023 by token
1. CCur VBA Function – Description
The CCur VBA function returns a value with the Currency data type . It is a floating point number formatted as a currency ranging from -922,337,203,477.5808 to 922,337,203,685,477.5807 . The Currency data type is 8 bytes in memory. . Attempting to call a function with an argument outside the range -922,337,203,477.5808 to 922,337,203,685,477.5807 will generate an error. We will also get an error if we enter a value that contains characters other than numbers as an argument. In practice, the currency type is rarely used. As a rule, the usual Single or Double types are used to hold numbers that represent monetary amounts.
2. VBA CCur function – Syntax
CCur (Expression) As Currency
Expression : Any number from -922,337,203,477.5808 to 922,337,203,685,477.5807 stored in any data type (including String).
Function return : Currency / Number ranging from -922,337,203,477.5808 to 922,337,203,685,477.5807.
3. VBA CCur function – Example
How to use CCur function in VBA Excel? Below are examples of using the CCur function in the VisualBasic Editor.
Example 1 : Example of VBA CCur function – result in the MsgBox window.
Dim CurValue As Currency CurValue = 12345.1234 MsgBox CCur (CurValue)
Example 2 : CCur VBA – Application example. The result in a sheet cell.
Dim CurValue As Currency CurValue = 4567.1234 Range ("A1") = CCur (CurValue)
4. VB CCur function – Additional information
- The function used for numbers outside the range -922,337,203,477.5808 to 922,337,203,685,477.5807 will return an error.
5. CCur VisualBasic function – Where to use?
The function can be used in: Excel 2003, Excel 2007, Excel 2010, Excel 2013, Excel 2016, Excel 2019, Excel 2021, Excel 365.
The article is part of the VBA Excel function list. You can find a list of all VBA functions at this address: VBA functions .