Are you searching for how to fix ‘Cannot run the macro’ in Excel? Then you’ve come to the right place. The message is one of many that may appear as a result of Runtime Error 1004. Other variations of the Excel Error 1004 include:

  • Application-defined or object-defined error: Runtime Error 1004
  • Method ‘Ranger’ of Object Worksheet Failed
  • Copy method of worksheet class failed
  • Programmatic access to Visual Basic Project is not trusted
  • Excel macro “Run-time error 1004″
  • Method open of object workbooks failed: Runtime Error 1004
  • Select method of Range class failed: Excel VBA Runtime Error 1004
  • Application-defined or object-defined error: Save As VBA Run Time Error 1004
  • Method range of object _global failed visual basic: Runtime Error 1004

What Is the Runtime Error 1004 In Excel?

Microsoft Excel is a useful and highly demanded spreadsheet that makes data computation easy. It is used by both individuals and businesses all over the world and comes in XLS and XLSX format.

However, while working on an Excel file or trying to generate a Macro, many users have been aggravated by the Runtime Error 1004. It prevents you from making any changes in your Excel workbook, makes you unable to use certain resource libraries, and freezes or crashes the program or even your system. It causes annoying performance problems while working with Visual Basic applications.

The Runtime Error 1004 can occur on any version of Excel: from Excel 2003 to Excel 2019. It mostly appears when you try running Microsoft Visual Basic for Applications Macro. The problem is due to a security procedure that is meant to lock Microsoft VBA from Excel. The Runtime Error 1004 likely won’t occur if you grant security access. The error could also be due to program corruption as a result of malware infection.

Why Am I Getting the Excel Runtime Error 1004?

The Runtime Error 1004 can appear as a result of:

  1. Corrupt MS Excel desktop shortcut.
  2. Copying and pasting filtered data into an MS Office Excel workbook.
  3. Program conflict while opening the VBA Excel file.
  4. Programmatically setting a range of values with a collection of large string.
  5. Application or object-defined error.

Whatever the reason may be, the issue is easy to get rid of. Keep reading to learn how to fix the Runtime Error 1004 when you make changes in Excel.

How to Fix the Runtime Error 1004 in Excel on Windows 10

The following solutions have been proven to work:

  1. Run an antimalware scan
  2. Allow Access to the VBA Project Object Model
  3. Create a new Excel template
  4. Uninstall Microsoft Works
  5. Remove GWXL97.XLA

By the time you have tried one or a few of the above fixes, the error will be resolved. We will now provide you with detailed steps to carry out the solutions.

Fix 1: Run an Antimalware Scan

This is the first fix you should try once you get the Runtime Error 1004. If your system is infected with viruses and other types of malware, you will run into unpleasant and unexpected issues. Your system and application will malfunction. Moreover, important files and documents get corrupted.

Run a full system scan with a strong antivirus program. We recommend you use Auslogics Anti-Malware. The tool has precision tools to detect and eliminate even the most elusive malicious elements that your existing antivirus program may miss. Auslogics is a Microsoft partner. They are a certified Microsoft Silver Application developer. Auslogics products have been tested and trusted by experts and millions of users worldwide.

Fix 2: Allow Access to the VBA Project Object Model

The procedure for this solution is easy. Follow the steps below:

  1. Launch Excel and click on the File tab.
  2. Click on Options.
  3. Click on Trust Center. It is the last option in the left pane.
  4. Click the Trust Center Settings button in the right pane.
  5. In the new page that opens, locate Macro Settings in the left pane and click on it.
  6. Mark the checkbox for ‘Trust access to the VBA project object model’ under the Developer Macro Settings section in the right pane.
  7. Click the OK button.

Fix 3: Create a New Excel Template

Rather than copy or duplicate your existing worksheet, you can put your new Excel Worksheet file within a template. This will help fix the Runtime Error 1004. Here’s how to get it done:

  1. Launch Excel.
  2. Press the Ctrl + N combination on your keyboard to open a new workbook. Make sure to leave only one sheet on the workbook. Delete the rest.
  3. Modify the workbook to suit your needs.
  4. Save the workbook by pressing Ctrl + S on your keyboard. Or if you use Excel 2003, click on the File tab and click Save as. For Excel 2007 and newer versions, click the Microsoft Office icon in the top-left corner of your screen and then click on Save as.
  5. Choose a location to save the file on your computer and enter a name for the file.
  6. Click the drop-down arrow beside ‘Save as type’ and select Excel Template (.xlt) if you are using Excel 2003. If you are using Excel 2007 and later versions, select Excel Template (.xltx) instead.
  7. After saving the template, use the following code to insert it:

Add Type:=path\filename

Make sure to replace “path\filename” with the actual path and file name of the template.

Fix 4: Uninstall Microsoft Works

Here’s the procedure to follow:

  1. Right-click on the Start button to open the Power User menu. Select Task Manager from the list. Alternatively, press the Ctrl + Alt + Del combination on your keyboard and then click on Task Manager.
  2. Once in Task Manager, click on each of the running apps and click the End Task button.
  3. Close the Task Manager window.
  4. Open the Run utility by pressing the Windows + R keyboard combination. Type “appwiz.cpl” (no quotes) into the text field and click the OK button or press Enter on your keyboard.
  5. Locate Microsoft Works in the list of apps and right-click on it. Then, click on Uninstall from the context menu. Confirm the action if prompted.

Fix 5: Remove GWXL97.XLA

Here’s how to delete the GWXL97.XLA file:

  1. Press the Windows + E combination on your keyboard to open File Explorer.
  2. Navigate this path: C: Users > User > Name > AppData > Local> MicrosoftExcel.
  3. Open the XLStart folder.
  4. Locate and delete the GWXL97.aXLA file.

Conclusion

We hope the solutions provided above have helped you to successfully fix the Runtime Error 1004 in Microsoft Excel and recover the data on your file. There are many issues that can lead to the runtime error. However, by the time you get to the end of this guide, you will be just fine.

Don’t hesitate to leave your questions or comments in the section below. We love hearing from you.