Excel VBA CCur Function

The CCur function in VBA is used to convert an expression into a Currency data type. It can take a maximum of 15 digits to the left of the decimal place and a maximum of 4 digits to the right of the decimal place.

Syntax

CCur (Expression)

Parameter

Expression (required)- This parameter represents the expression that is converted to a Currency.

Return

This function returns a currency value ranging between -922,337,203,685,477.5808 and 922,337,203,685,477.5807.

Example 1

Sub CCurFunction_Example1()
 ' Converting the values Into Currency Data Types
 Dim cur As Currency
 cur = CCur(25)
 ' cur variable will return $25.00
 Cells(1, 1).Value = cur
 End Sub 

Output

$25.00

VBA CCur Function

Example 2

Sub CCurFunction_Example2()
 ' Converting the values Into Currency Data Types
 Dim cur As Currency
 'negative value
 cur = CCur(-25)
 ' cur variable will return ($25.00)
 Cells(1, 1).Value = cur
 End Sub 

Output

($25.00)

Example 3

Sub CCurFunction_Example3()
 ' Converting the values Into Currency Data Types
 Dim cur As Currency
 'negative value
 cur = CCur(5525)
 ' cur variable will return $5,525.00
 Cells(1, 1).Value = cur
 End Sub 

Output

$5,525.00

VBA CCur Function