logo
search
VBA & Macro Problems

How to Set a Dollar Currency Symbol in Excel VBA

Algirdas JasaitisAlgirdas Jasaitis Oct 9, 2026 868 views

Question details

The user needs to display a specific dollar sign ($) in Excel using VBA, bypassing the default regional currency symbol applied by the system.

How to Set a Dollar Currency Symbol in Excel VBA
Product
Excel
Device & OS
not provided
Scenario
Applying custom number formats to cells via VBA scripts to show financial values.
Observed behavior
Excel VBA automatically applies the regional system currency symbol (such as £ or €) instead of the intended dollar sign when a standard currency format is applied in the script.
Before you start

Ensure you have the Developer tab enabled to access the VBA editor. It is always good practice to test your macro on a small range of cells before applying formatting across your entire dataset.

Solution 1Recommended

Use a Backslash to Treat the Dollar Sign as a Literal Character

Prevent Excel from automatically replacing the dollar sign with the local system currency symbol by using a backslash escape character in your VBA number format string.

When you apply a currency format like "$#,##0.00" in VBA, Excel often adapts the symbol to match the user's regional system settings. To force the exact display of a dollar sign regardless of geographic location, you must escape it using a backslash (\).

1
Open the VBA Editor

Press Alt + F11 on your keyboard to open the Visual Basic for Applications (VBA) editor.

2
Locate the Target Macro

In the Project Explorer, find and double-click the module or worksheet where your formatting script is located.

3
Apply the Literal Character Format

Update your number format string to include a backslash before the dollar sign. For example, use the code: cell.NumberFormat = "\$#,##0.00;[Red]-\$#,##0.00;;".

4
Run the Script

Press F5 or click the Run button to execute the macro. The targeted cells will now display the exact dollar sign symbol.

Use a Backslash to Treat the Dollar Sign as a Literal Character
Understanding the format structure: The format string "\$#,##0.00;[Red]-\$#,##0.00;;" dictates how different values are shown: positive numbers with a dollar sign, negative numbers in red with a minus and dollar sign, and zero values left blank.
Efficient Spreadsheet Management

Run and Edit VBA Macros Seamlessly in WPS Spreadsheet

WPS Office provides excellent compatibility with Excel macros, allowing you to run, edit, and troubleshoot VBA scripts like currency formatting directly within WPS Spreadsheet.

  1. 1. Download and Install: Download WPS Office for free and open your macro-enabled spreadsheet.
  2. 2. Access the VBA Editor: Navigate to the Developer tab and click on the Visual Basic icon to open the script editor.
  3. 3. Format Using VBA: Enter your formatting script using the literal dollar sign syntax and run the macro to instantly format your data.
Highly compatible with Microsoft Excel VBA syntax and macrosFormat cells easily with advanced custom number propertiesLightweight application with a familiar ribbon interfaceExcellent support for Microsoft Office file formats (.xlsm, .xlsx)
microsoft office alternative - wps office

Frequently Asked Questions

Why does my Excel macro change the dollar sign to a pound or euro symbol?

Excel's default behavior for currency formatting relies on your computer's regional system settings. If your Windows region is set to the UK or Europe, a generic currency format in VBA will default to £ or €. Using an escaped literal character (\$) forces Excel to ignore the regional setting.

Can I use the FormatCurrency function in VBA instead?

The FormatCurrency function returns an expression formatted as a currency value using the system control panel settings. Because it still relies on regional settings, using the .NumberFormat property with an escaped literal character is a much more reliable method for forcing a fixed dollar sign.

How do I format an entire column with the literal dollar sign?

You can easily apply the custom number format to an entire column in VBA using the Columns property. Simply write your code as: Columns("B:B").NumberFormat = "\$#,##0.00".