How to Fix Run Time Error 1004 in Excel

This article aims to help you fix the run time error 1004 when you run Microsoft Visual Basic. Keep reading and check more details about how to fix Runtime error 1004 in Excel.

 Free Download

Trustpilot Rating 4.8

 Free Download

Secure Download

Table of Contents

EaseUS Fixo

AI-Enhanced

  • Fix videos with different issues, such as broken, unplayable, no sound, etc.
  • Repair corrupted images and enhance their quality with advanced AI algorithms.
  • Fix documents in various formats, including PDF, Word, Excel, and PowerPoint files.
 Free Download

100% Safe Download

Fix runtime error

The Run-time error 1004 in Excel usually happens when running macros or modifying range values or when there is an issue with the VBA code. The run time error 1004 appears when there are too many legend entries in the Microsoft Excel chart compared to the available space.

Four ways to fix run time error 1004 in Excel:

Workable Solutions Step-by-step Troubleshooting
Fix 1. Repair Corrupted Excel File Repair corrupted Excel files with a file recovery tool. EaseUS file repair tool fixes severely corrupted XLS and XLSX files and retrieves everything from Excel...Full steps
Fix 2. Delete the GWXL97.XLA Files Project Object Model Fix the Excel error 1004 to find and delete the error file. Go to C:\Program Files\MS Office\Office\XLSTART...Full steps
Fix 3. Check the Trust Access to the VBA Enable a VBA project trust option in Excel Trust Center to fix Excel error 1004. Open a blank Excel file...Full steps
Fix 4. Create Another Excel Template Start a new Excel workbook and make sure there is only one worksheet in it. Format the workbook first...Full steps

Microsoft Visual Basic for Applications (VBA) is developed to help users write programs for the Windows operating system. It runs as an internal programming language in Microsoft Office, such as Word, Excel, and PowerPoint.

Some users have reported that when running VBA in an Excel chart or trying to generate a Macro in Excel documents, an error message popped up saying: Runtime error 1004. And then they find themselves cannot access the Excel files. If you have the same encounter as these users, this post is the right place for you. You can find both the reasons for this error code and the corresponding solutions on this page.

How to Fix Excel Error 1004

Run Time Error 1004 Details

The error message contains more information than the error code 1004. Generally, following the error code, you can see a brief description. The most repeated error messages are listed below:

  1. Run-time error 1004: Application or object-defined error.
  2. Run-time error 1004: Method Ranger of Object Worksheet failed.
  3. Run-time error 1004: Copy Method of Worksheet Class failed.

Fix 1. Repair Corrupted Excel Files Due to Run Time Error 1004 

If all the above solutions can't help you out, then there is one possibility that the Excel file you want to open is damaged. To fix a damaged Excel file, you can rely on file repair software. EaseUS Fixo Document Repair is a great choice.

 Free Download

Trustpilot Rating 4.8

 Free Download

Secure Download

With this tool, click the "Repair" button and wait for it to fix all the corrupted documents for you.

  • Repair various corrupted files, including repairing Word, Excel, and PDF document 
  • Fix unreadable contents in Word efficiently
  • Repair corrupted PDF files, extract the text, comments, labels, graphics, etc. 
  • Compatible with Microsoft Office 2019, 2016, 2013, 2010, & previous versions.

Before you are going to fix runtime error 1004 in Excel, watch this video first. It provides you with more details on file repair.

  • 00:05 Introduction
  • 00:26 Method 1. Repair Corrupted Excel Files with EaseUS Fixo Document Repair
  • 01:34 Method 2. Repair Excel Files with Open and Repair Option
  • 02:12 Method 3. Repair Damaged Excel Files by Changing File Extension
repair corrupted Excel files
 

Download the software and follow the detailed steps below to fix corrupted Excel files.

Step 1. Download and launch Fixo on your PC or laptop. Choose "File Repair" to repair corrupted Office documents, including Word, Excel, PDF, and others. Click "Add Files" to select corrupted documents.

add files to repair documents with Fixo

Step 2. To repair multiple files at once, click the "Repair All" button. If you want to repair a single document, move your pointer to the target file and choose "Repair". You can also preview the documents by clicking the eye icon.

select documents to repair

Step 3. Click "Save" to save a selected document. Select "Save All" to save all the repaired files. Choose "View Repaired" to locate the repaired folder.

save repaired documents in Fixo

Fix 2. Delete the GWXL97.XLA Files to Fix Run Time Error 1004 in Excel

The easiest method to fix the Excel error 1004 is to find and delete the error file.

Step 1. Go to C:\Program Files\MS Office\Office\XLSTART.

Step 2. Find GWXL97.XLA file and delete it.

Step 3. Reopen your Excel file and check if the problem is solved.

Share this post on social media to help others learn how to fix the run time error 1004 in Excel files.

 

Fix 3. Check the Trust Access to the VBA Project Object Model

Another solution you can try is to enable a VBA project trust option in Excel Trust Center. Follow the detailed steps and try them.

Step 1. Open a blank Excel file and click "Files" on the upper left.

Step 2. Click Option and go to Trust Center.

Enter Excel Option

Step 3. Find and enter the Trust Center Settings.

Enter Trust Center Settings

Step 4. Under Macro Settings, tick the option of "Trust access to the VBA project object model."

Trust Access to the VBA Project

Now you can check your Excel file.

Fix 4. Create Another Excel Template to Fix Run Time Error 1004 in Excel

This method could be a little bit complicated, but it's useful and worth trying.

Step 1. Please start a new Excel workbook and make sure there is only one worksheet in it.

Step 2. Format the workbook first and then put the data you need onto it.

Step 3. Tap File > Save As, first enter the file name, and click the unfold arrow in Save as Type column.

Excel Save As

Excel 2003: Choose Excel 97-2003 Template.

Excel 2007 or Later: Choose Excel Template.

Choose the Right Template

Step 4. Click "Save" to confirm.

Now you can insert it programmatically by using the following code: Add Type:=path\filename. The file name is the one you set when you create the new Excel template.

The Reason Why You See Run-time Error 1004 in Excel

If you want to know how to fix runtime error 1004 in Excel properly, you need to understand what leads to this issue. The following are the most prominent reasons.

  • Macro Name Error: The Macro you are running is copying the original worksheet to a workbook with a defined name that you did not save and close before running the Macro.
  • File Conflict: When opening the VBA Excel file, it conflicts with other programs.
  • Too Many Legend Entries: The Excel chart contains more legend entries than the space available to display the legend entries on the chart.
  • Excel File Corruption: Your .xls files got corrupted, infected, or damaged.

Although many reasons would cause this Excel error 1004 problem, luckily, some valid methods can help users re-access the files. Let's check them one by one.

The Bottom Line

After reading, you must have a thorough understanding of how to fix Runtime error 1004. If you can make sure that the Excel file you want to open is valid, then the first three methods will help you out.

Once you got a damaged Excel file, a professional file recovery tool is a wiser choice. EaseUS Fixo is highly recommended by many users & IT professionals to help you repair Word, Excel, PowerPoint, and PDF files. 

 Free Download

Trustpilot Rating 4.8

 Free Download

Secure Download

Was This Page Helpful?

About the Author

author Cedric

Cedric

Cedric Grantham is a senior editor and data recovery specialist of EaseUS. He mainly writes articles and how-to tips about data recovery on PC and Mac. He has handled 10,000+ data recovery cases and is good at data recovery of NTFS, FAT (FAT32 and ExFAT) file systems, and RAID structure reorganization.

Read full bio