logo
search
VBA & Macro Problems

How to Fix Excel VBA SpellNumber Function for Currency Codes

Maira MehtabMaira Mehtab Sep 24, 2026 870 views

Question details

The user needs to resolve an issue with an Excel VBA add-in that uses a SpellNumber function to convert numbers into words for specific currency codes like INR, USD, SAR, and EUR.

Product
Excel
Device & OS
not provided
Scenario
Using a custom VBA macro or add-in to convert numeric values into text strings with specific international currency formatting.
Observed behavior
The macro or add-in is likely failing to execute, update, or return the expected text conversion for the specified currencies.
Before you start

Ensure that macros are enabled in your Excel Trust Center settings and that your VBA add-in file (.xla or .xlam) is saved in a trusted location.

Solution 1Recommended

Reload the Excel File and VBA Add-in

Custom VBA functions like SpellNumber can fail to calculate if the add-in connection drops or the workbook state becomes stale. Reloading refreshes the calculation tree.

Often, simply restarting the application and forcing a refresh of the installed add-ins can resolve temporary macro execution glitches without needing to edit the code.

1
Close Microsoft Excel

Save your current work and completely close Microsoft Excel to clear the application's cache.

2
Reopen the Workbook

Launch Excel again and open the specific workbook containing your SpellNumber formulas.

3
Refresh Add-ins

Navigate to 'File' > 'Options' > 'Add-ins'. Ensure your custom VBA add-in is active. If it is unchecked, check the box and click 'OK' to reload it.

4
Force Recalculation

Press F9 on your keyboard to force a recalculation of all formulas in the workbook.

Quick Fix: If a temporary memory glitch caused the issue, the #NAME? or #VALUE! errors in your cells should instantly change to the correctly spelled currency strings.
Advanced Macro Support

Convert Numbers to Words using Macros in WPS Spreadsheets

WPS Spreadsheets provides robust support for VBA macros, allowing you to seamlessly run custom functions like SpellNumber to handle multiple international currency conversions with ease.

  1. 1. Open your Workbook: Launch WPS Spreadsheets and open your .xlsm file containing the custom SpellNumber macro.
  2. 2. Enable Macros: Click on the security warning prompt that appears below the ribbon to 'Enable Macros' for the document.
  3. 3. Access the VBA Editor: Go to the 'Developer' tab and click on 'Visual Basic' to review or paste your currency conversion code into a new module.
  4. 4. Apply the Function: Type `=SpellNumber(A1, "USD")` in any cell to instantly convert the numeric value into formatted English text.
Fully compatible with Microsoft Excel .xlsm and .xlam macro formats.Lightweight application footprint with high performance for complex calculations.Supports standard VBA syntax for string manipulation and custom formatting.Familiar spreadsheet interface ensures a seamless transition.
microsoft office alternative - wps office

Frequently Asked Questions

Why does my SpellNumber function return a #NAME? error?

A #NAME? error typically occurs if the VBA code isn't stored in a standard module within the active workbook, if the add-in is not loaded, or if macros have been disabled by your security settings.

Can I add more currency codes to the SpellNumber VBA script?

Yes. You can edit the VBA code to include additional 'Case' statements that define the major and minor currency names (e.g., Pounds and Pence for GBP) alongside INR, USD, SAR, and EUR.

How do I make the SpellNumber function available in all my workbooks?

To use the function globally, save the workbook containing your VBA code as an Excel Add-in file (.xlam) and activate it via the Excel Add-ins dialog box (File > Options > Add-ins).

Does WPS Office support custom VBA functions like SpellNumber?

Yes, the VBA-enabled versions of WPS Office fully support user-defined custom functions, allowing you to run your existing SpellNumber scripts and add-ins without requiring modifications.