How to Set a Dollar Currency Symbol in Excel VBA
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.

- 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.
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.
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 (\).
Press Alt + F11 on your keyboard to open the Visual Basic for Applications (VBA) editor.
In the Project Explorer, find and double-click the module or worksheet where your formatting script is located.
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;;".
Press F5 or click the Run button to execute the macro. The targeted cells will now display the exact dollar sign symbol.

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. Download and Install: Download WPS Office for free and open your macro-enabled spreadsheet.
- 2. Access the VBA Editor: Navigate to the Developer tab and click on the Visual Basic icon to open the script editor.
- 3. Format Using VBA: Enter your formatting script using the literal dollar sign syntax and run the macro to instantly format your data.

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".




