logo
search
VBA & Macro Problems

How to Fix Custom VBA Functions Not Working in Excel for the Web

Aamir Naveed AkramAamir Naveed Akram Oct 10, 2026 869 views

Question details

The user needs to resolve an issue where custom VBA functions fail to execute in a shared workbook hosted online.

How to Fix Custom VBA Functions Not Working in Excel for the Web
Product
Excel for the Web
Device & OS
not provided
Scenario
Attempting to use or calculate custom VBA functions created in the desktop application while viewing or collaborating on the file via Excel for the Web.
Observed behavior
The custom VBA functions do not run directly in Excel for the web, resulting in calculation failures or unrecognized function errors even when the file is stored on OneDrive.
Before you start

Verify whether your spreadsheet strictly requires VBA to function. Because Excel for the Web lacks a VBA execution engine, workarounds require replacing VBA scripts with standard formulas or opening the file in a desktop application.

Solution 1Recommended

Replace VBA Logic with Standard Built-in Formulas

Since Excel for the Web cannot run VBA, replacing your custom functions with native Excel formulas ensures your calculations work across all platforms.

Many custom VBA functions are created to perform conditional logic that modern built-in Excel functions can now handle natively. Transitioning to standard formulas ensures web compatibility.

1
Identify the underlying logical rule

Analyze the custom VBA function in your desktop application to understand the mathematical or conditional rule it applies (e.g., summing cells based on a specific threshold).

2
Construct a built-in formula

Recreate the rule using standard Excel functions like SUMIFS, COUNTIFS, or nested IF statements, which are fully supported in the web browser environment.

3
Apply to your dataset

Replace the cells currently calling the custom VBA function with your newly constructed standard formula, then drag the fill handle to apply it to the remaining rows.

Replace VBA Logic with Standard Built-in Formulas
Handling Color-Based Logic: If your VBA function was designed to sum cells by background color based on a consistent rule, calculate that rule directly using standard formula conditions instead of relying on the cell's formatting.
Free Microsoft Office alternative

Run VBA and Macros Smoothly with WPS Office

If your workflow heavily relies on VBA macros and custom functions that fail in web-based spreadsheet tools, consider switching to WPS Office. It provides robust desktop support for VBA and macros, ensuring your advanced scripts run flawlessly while maintaining full compatibility with your existing spreadsheet files.

  1. 1. Download and Install WPS Office: Get WPS Office Free from the official website and install the desktop suite on your computer.
  2. 2. Open your macro-enabled workbook: Launch WPS Spreadsheets and open your .xlsm or .xlsb file containing the custom VBA functions.
  3. 3. Enable Macros: Click 'Enable Macros' in the security warning prompt at the top of the screen to allow your custom VBA functions to calculate normally.
High compatibility with Microsoft Excel formats including .xlsx, .xls, and .xlsm.Robust native support for executing and editing VBA macros and custom functions.Free and lightweight desktop application with a familiar user interface.Seamless migration of your existing macro-enabled spreadsheets without needing to rewrite scripts.
microsoft office alternative - wps office

Frequently Asked Questions

Why do my custom VBA functions show a #NAME? error in Excel for the Web?

Excel for the Web does not support the execution of VBA macros or custom user-defined functions (UDFs). When you open a workbook containing these functions in a browser, Excel cannot process the background VBA code, resulting in a #NAME? or #VALUE! error.

Can I use Office Scripts instead of VBA in Excel for the Web?

Yes, Office Scripts are specifically designed to automate tasks in Excel for the Web. However, they use TypeScript rather than VBA. You would need to rewrite your custom VBA logic as an Office Script to execute it natively in the web browser.

How can I sum cells by color without using VBA?

Because standard Excel formulas cannot detect cell fill colors, you must use a workaround. You can either recreate the logical rule used to apply the color within a SUMIFS function, or add a helper column to manually flag the rows and sum based on that column's text or number value.

Will my VBA code be deleted if I edit the file in Excel for the Web?

No, your VBA code and macros are safely preserved in the background of the file. You simply cannot run or edit them in the web version. When you reopen the workbook in a compatible desktop spreadsheet application, your VBA functions will be restored and function normally.