Dim num as Double
Dim strCurrency as String
num = 1234.56
strCurrency = FormatCurrency(num)
MsgBox strCurrency
price/0$ off/free

Example 2: Specifying Currency Format

The FormatCurrency function also allows the user to specify the currency format they want to use. This is done by adding a second argument to the function, specifying the desired currency code.

Dim num as Double
Dim strCurrency as String
num = 1234.56
strCurrency = FormatCurrency(num, "EUR")
MsgBox strCurrency

Example 3: Formatting Negative Numbers with Parentheses

The FormatCurrency function also allows the user to specify how negative numbers should be displayed by using a third argument called IncludeLeadingNeg. When set to True, negative numbers will be displayed within parentheses.

Dim num1 as Double, num2 as Double
Dim strCurrency1 as String, strCurrency2 as String
num1 = 1234.56
num2 = -1234.56
strCurrency1 = FormatCurrency(num1, , True)
strCurrency2 = FormatCurrency(num2, , True)
MsgBox "Positive: " & strCurrency1 & vbNewLine & "Negative: " & strCurrency2