How to Resolve the Runtime Error 1004?

Runtime errors are common problems faced by Windows users. The error code 1004 is one of them. Microsoft Excel abnormalities or issues with the Microsoft Excel files contribute to this error code. Once it occurs, it will bring different challenges with it, until you resolve the matter. To know more, regarding the error 1004, keep studying this article till the end. From this article, you will also learn effective tricks by which you can get rid of it.

There are a number of variations of the error message, which are as given below.

  1. Most of the MS Office users get these two variations of the error message.
  2. Excel macro “Run-time error ‘1004’″
  3. VB: run-time error ‘1004’: Application-defined or object-defined error
  4. Other forms of the error message are as follows:runtime error 1004 method range of object _global failed visual basic
  5. Excel VBA Runtime error 1004 “Select method of Range class failed”Run-Time error ‘1004’: ‘Method Ranger’ of ‘Object Worksheet’ Failed
  6. Runtime error 1004 method open of object workbooks failedSave As VBA Run-time Error 1004: Application defined or object defined error

What Causes Runtime Error “1004”?

There are several factors which are responsible for the error 1004. Some of them are as follows.

  • Corrupt or damaged MS Excel application
  • VBA Excel file conflict with other programs
  • A virus or malware attack
  • Invalid Registry Keys
  • Application or object defined error
  • Absence of important file

No matter what causes the runtime error in MS Excel, after a thorough study of this article you will able to fix this problem efficiently.

Effects of 1004, the Runtime Error in Microsoft Excel

You may already be aware of the effects of the error 1004. In general, many of the users face this error while copying the original worksheet, which is already running in a macro to a workbook along with a name which is pre-defined.

This error can also result in data loss in Excel. Crashing down the program or system while working with Visual Basic Applications is another effect of the error code 1004, the runtime error. As this is a more serious problem, so solving it quickly is a very important task you need to perform. Below, you will get some effective methods to fix this error.

Methods to Solve Runtime Error 1004

Now, here in this section, we are going to discuss the methods with which many users have already utilized to resolve the runtime error code 1004. So, let’s not waste time and try the methods as below.

Run a Virus Scan

Ensuring no presence of viruses in the system will be the best primary task to perform. Because the presence of a virus can damage the system files, which is one of the many other reasons responsible for the error 1004. And the steps which you need to follow to run a virus scan depends on the antivirus tool you are using.

In case, you are a Windows 10 user, then the Windows Defender tool can fix the virus related matters efficiently. The Defender tool is very advanced and can eradicate virus infections in your computer via a complete scan.

Method 1: Uninstall Microsoft Works to Recover MS Excel

After a virus scan if you are still stuck with the error, then uninstall MS Works, which may eradicate the error 1004. And the steps to follow to do it are as below.

  1. First of all, open the search bar by pressing down the Windows button.
  2. Then, on the search bar, type control and hit the Enter key. This will brings up the Control Panel window.
  3. Now, ensure that the View by section is set as Category, and if not, then drop down the menu list for it and select the Category option.
  4. After that, from the available options, select Programs> Programs and Features to get all the installed programs to list on the screen.
  5. Now, from this installed programs list, search for Microsoft Works, and right click on it. And then select Uninstall> Uninstall to confirm.

Hopefully, now you can work with the MS Excel application, without getting the error 1004. If however, the error still persists, then continue with the next methods.

Method 2: Delete GWXL97.XLA to Fix Runtime Error

This is another way to solve MS Excel error 1004.

  1. At first, press both the Windows and the letter E key at a time to get the Windows Explorer open.
  2. Then, from the available options under the Windows Explorer, double-click on the Program Files folder to open.
  3. After that, open the Microsoft Office folder and under it you will get a folder named as OfficeXX, open it. In place of XX, you will get the MS Excel version.
  4. Next, from the available folder options under OfficeXX, open XLSTART.
  5. Now, here you will get “GWXL97.XLA” under the Name section. Right-click on it and select the Delete option.
  6. Then, open the Excel file again and check if the issue gets resolved.

Method 3: Save Excel Workbook

Excel is a great project by Microsoft Inc. With the help of the macros facility, you can copy worksheets to save its duplicate into the same workbook where it is actually located. However, if this process is not correctly executed, it can result in error code 1004, the runtime error in Excel. Sometimes, this error code generates as the object-defined error or application-defined error message.

The exact reason behind the error is if the user sets the workbook a name and make a duplicate of it without closing it beforehand.

And after knowing the possible reasons, now, hopefully, your concern will be how to handle this matter. The answer to this is as explained below.

You just need to save the workbook periodically after you have copied it. Also, remember that every time when you want to copy the file, you need to keep saving the file beforehand. The time consumed to save the file depends upon its size. By doing this, you may find that the error gets resolved.

Method 4: Fix Error 1004 by Modifying the Trust Center Settings

According to many users, they get the problem solved by following this method. And the steps to proceed to begin this method is as below.

Before you start this method, ensure that your computer is running with Administrative rights. And then launch the MS Excel application.

Now, take the mouse pointer to the extreme top-left corner of the MS Excel window and that is to the four blocks symboled Office button.

Then, under this Office button window, you will find the Excel button in the bottom right corner, click on it. Next, select the Trust Center option from the left side panel. After that, click on the “Trust Center Settings…” button. This will open up the Trust Center window.

Further, click on the Macro Settings option from the left side panel of this Trust Center window. And then enable the checkbox beside “Trust access to the VBA project object model”, which is located under the Developer Macro Settings section and click on OK. This will bring you two options for solving the problem which are as follows.

  • Modifying VBA Macro code for copy and paste purpose of only single rows, which holds the data.
  • Modifying VBA Macro code to loop copy, to enhance copying small portions at one time.

Hopefully, after going through this method you will fix the runtime problem 1004.

Method 5: Create New Excel Template

It’s better to create a new worksheet to solve error 1004, rather than copying one. The steps by which you can create a new Excel template is explained below.

At first, launch the Microsoft Excel application. After that, create a new Workbook file. Next, remove Worksheets one by one.

Then make a format to the Workbook of your choice. You can insert charts, data or text in it.

After that, click on the four blocks symboled Office button, and select the “Save As” option. This will pop-up a window, with an option for Save as type and a space for Filename. Set the Save as type as Template, and enter a name for this file and click on the Save button, to complete this method.

Note: If you would like to programmatically insert the template then use the following code:

Sheets.Add Type:=path\filename

filename = the path of the saved template

Mentioned above are the workarounds to solve 1004, the runtime error. In case there are any queries regarding the error you can leave that in the comment section below.

Maria Colombo
Maria Colombo
Articles: 1200