Excel Error Codes

Fix Excel Runtime Error 1004: Method Add of Sheets Failed

Nimra MalikNimra Malik Oct 26, 2026 868 views

Question details

The user needs to resolve an issue where a macro fails to add a new worksheet in an older Excel workbook.

Fix Excel Runtime Error 1004: Method Add of Sheets Failed
Product
Microsoft Excel
Device & OS
not provided
Scenario
Running a VBA macro to add a new worksheet in a legacy workbook originally created in 2005.
Observed behavior
The macro triggers 'Runtime Error 1004: Method Add of Sheets Failed' in the older workbook, despite the exact same macro running successfully in a newer, identical workbook.
Before you start

Ensure you have the Developer tab enabled in your Excel ribbon to access the VBA editor, and verify whether your workbook structure is protected with a password.

Solution 1Recommended

Update Obsolete Macro Functions to VBA 7

Replace outdated Excel 4.0 macro functions with modern VBA code to restore full compatibility.

Older workbooks created in earlier versions of Excel (such as Excel 2003 or 2005) often rely on legacy Excel 4.0 macro functions. Microsoft has significantly reduced support for these obsolete functions in modern updates.

When modern Excel attempts to execute an outdated sheet-adding function, it triggers Runtime Error 1004. Upgrading the specific code block to standard VBA 7 alternatives will resolve this compatibility issue.

1
Open the VBA Editor

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

2
Locate the macro code

In the left-hand Project Explorer pane, find the module containing the macro that adds worksheets and double-click to open it.

3
Replace legacy code

Identify any obsolete Excel 4.0 macro commands and replace them with standard VBA sheet creation code, such as 'Sheets.Add After:=ActiveSheet'.

4
Save and test

Click the Save icon, close the VBA editor, and run your macro again to confirm the worksheet is added without errors.

Update Obsolete Macro Functions to VBA 7
Compatibility Check: Updating your code to standard VBA 7 ensures that your macros will continue to function properly in all current and future versions of Excel.
Free Microsoft Office alternative

Edit Legacy Spreadsheets Smoothly with WPS Office

If you frequently encounter macro compatibility issues, runtime errors, or sluggish performance with legacy Microsoft Excel files, consider switching to WPS Office. It provides a lightweight, highly compatible, and free alternative for managing your spreadsheets.

  1. 1. Download the software: Visit the official WPS Office website and click on 'Download WPS Office Free'.
  2. 2. Install WPS Office: Run the downloaded installer file and follow the on-screen prompts to set up the software.
  3. 3. Open your files: Right-click your existing Excel workbooks and select 'Open with WPS Spreadsheets' to start working immediately.
Seamless compatibility with older .xls and modern .xlsx Microsoft Excel formatsFamiliar, easy-to-use interface with zero learning curve for seamless migrationLightweight architecture that opens large and complex legacy files quicklyFree to use with comprehensive spreadsheet formatting and data analysis tools
microsoft office alternative - wps office

Frequently Asked Questions

Why does Error 1004 only happen in the older version of my workbook?

The older workbook (created around 2005) likely contains legacy configurations, Excel 4.0 macro structures, or specific file limitations (.xls format limits sheets and memory differently) that conflict with modern Excel's security and VBA execution engines.

How do I know if my workbook uses obsolete Excel 4.0 macros?

Legacy Excel 4.0 macros are often stored on hidden 'Macro Sheets' rather than in the modern VBA editor. Right-click on any visible sheet tab, select 'Unhide', and look for any sheets categorized as Macro sheets.

Can reaching the maximum worksheet limit cause Runtime Error 1004?

Yes. While modern Excel limits sheets only by available memory, older .xls formats or specific memory constraints can restrict adding new sheets. If the memory allocation is maxed out, the 'Add' method will fail and trigger this runtime error.