How to Fix Run-time Error 1004, Cannot Run the Macro in Excel

Updated May 2024: Stop getting error messages and slow down your system with our optimization tool. Get it now at this link
  1. Download and install the repair tool here.
  2. Let it scan your computer.
  3. The tool will then repair your computer.

MS Excel is a very popular spreadsheet program and is used worldwide to store, organize and manipulate data. It is used for both individual and professional purposes and is available in two extensions: XLS and XLSX format. However, in addition to its popularity, it is also perceived to be corrupted and therefore displays execution error 1004.

What is Runtime Error 1004 in VBA Excel?

Excel Runtime Error 1004 is one of those annoying runtime errors that mainly occur when working with the Excel file. Or when you try to generate a macro in a Microsoft Excel spreadsheet and therefore cannot do anything in your workbook.

This error can cause serious problems when working with Visual Basic applications and can cause your program or system to crash or, in some cases, freeze for a period of time. This error also occurs with all versions of MS Excel, such as Excel 2007/2010/2013/2016/2019.


Error Code: run-time error 1004
Description:Application or object-defined error

How to Fix Run-time Error 1004, Cannot Run the Macro in Microsoft Excel

Don’t worry, you can correct this Microsoft Visual Basic 1004 runtime error by simply following the steps mentioned in this article. But before we get into the troubleshooting section, read the article on runtime error 1004.

Workaround for Mac

  • Click on the Excel menu
  • Click Preferences
  • In the Sharing and Privacy section, click on Security
  • Then, activate Enable all macros (…) and trust the access to the VBA project object model
  • You can now safely open XLSTAT.

Workaround for Windows and Mac

To get around this problem, it is easy to insert a new worksheet from a template instead of creating a copy of an existing worksheet. To work around this problem, you need to do the following:

May 2024 Update:

You can now prevent PC problems by using this tool, such as protecting you against file loss and malware. Additionally, it is a great way to optimize your computer for maximum performance. The program fixes common errors that might occur on Windows systems with ease - no need for hours of troubleshooting when you have the perfect solution at your fingertips:

  • Step 1 : Download PC Repair & Optimizer Tool (Windows 10, 8, 7, XP, Vista – Microsoft Gold Certified).
  • Step 2 : Click “Start Scan” to find Windows registry issues that could be causing PC problems.
  • Step 3 : Click “Repair All” to fix all issues.

Download Now

  • Start Excel.
  • Create a new workbook and delete all but one of the worksheets in it.
  • Format the workbook.
  • By default, add the text, data, and/or graphics you want in the template to the one worksheet that now contains the workbook.
  • If you are using Excel 2003 or earlier, click File > Save As. If you are using Excel 2007 or later, click the Microsoft Office button, then click Save As.
  • In the File name: box, type the name you want to give to the template.
  • Open the drop-down menu next to the Save As: box and click Excel Template (.xlt) if you are using Excel 2003 or earlier, or click Excel Template (.xltx) if you are using Excel 2007 or later to select it.
  • Click “Save”.
  • When you have successfully created the template, you can insert it by programming it using the following line of code:
    • Sheets.Add Type:=path\filename

Note: In the code line described above, the file path should be replaced by the full path (including the full filename) to the location of the sheet template you just created.

Scanning for Malware

As a precautionary measure, you should also check for malware. So be sure to run your anti-malware scanner and scan regularly to see if anything is displayed. If nothing is displayed, we recommend a full virus scan to make sure everything is fine.

Microsoft Defender is an excellent tool for this task, but if you feel that this is not enough, we recommend that you use a free, stand-alone malware scanner.

Expert Tip: This repair tool scans the repositories and replaces corrupt or missing files if none of these methods have worked. It works well in most cases where the problem is due to system corruption. This tool will also optimize your system to maximize performance. It can be downloaded by Clicking Here

Scroll to Top