Got the VBA runtime error 1004? Fix it fast with these steps

by Vlad Turiceanu
Vlad Turiceanu
Vlad Turiceanu
Passionate about technology, Windows, and everything that has a power button, he spent most of his time developing new skills and learning more about the tech world. Coming... read more
Affiliate Disclosure
  • Encountering the VBA runtime error 1004 is not a good sign, but this article could prove helpful.
  • This error implies that you won't be able to use MS Excel normally, which can cause a variety of issues at work.
  • For more useful and detailed information, don't hesitate to visit our extensive Microsoft Excel Hub.
  • If you want to always be one step away from runtime errors, bookmark our useful Runtime Errors webpage.
To fix various PC problems, we recommend DriverFix:
This software will keep your drivers up and running, thus keeping you safe from common computer errors and hardware failure. Check all your drivers now in 3 easy steps:

  1. Download DriverFix (verified download file).
  2. Click Start Scan to find all problematic drivers.
  3. Click Update Drivers to get new versions and avoid system malfunctionings.
  • DriverFix has been downloaded by 0 readers this month.

If you work in an organization, you most probably have the latest version of the Microsoft Office suite or Office 365 installed on your PC.

Even if this one of the best spreadsheet tools in the market, this doesn’t make Microsoft Excel immune to occasional bugs. This would be the case with an error message users have been reporting: Run time error 1004. Application-defined or object-defined error.

How can I fix the VBA runtime error 1004?

1. Check your Excel add-ins

manage office add-ins

  1. Click File -> Options ->Select Add-ins
  2. Click the Go button
  3. Select the add-ins you want to disable or remove
  4. Uncheck the box in front of the respective add-in
  5. Click OK

2. Verify Excel or install the latest updates

  1. Right-click the Start button
  2. Select Apps and Features on the pop-up menu.
  3. Select the Microsoft Excel, and select Modify

Depending on whether your copy of Office is Click-to-run or MSI-based install, the next steps will vary a little.


A window called How would you like to repair your Office Programs will appear

  1. Select Online Repair
  2. Choose Repair to make sure everything gets fixed
    • The Quick Repair option is faster but it only detects and then replaces corrupted files
      Microsoft Office Repair Windows 10


  1. In Change your installation, select Repair
  2. Click Continue
  3. Follow the given instruction to complete the process

3.  The named range doesn’t exist

The most common cause of a run-time Error 1004 is when VBA code refers to a named range that doesn’t exist. Maybe the name is spelled wrong in the code or maybe a valid name is used, but it is on an inactive worksheet. In this second case, the solution is to qualify the range reference with a worksheet (and perhaps the workbook).

  1. Worksheet Sheet1 is active, named range Foobar is on Sheet2
  2. Dim cel As Range
  3. Set cel = Range(“Foobar”) ‘Causes runtime error 1004
  4. Set cel = Worksheets(“Sheet2”).Range(“Foobar”) ‘This works

A less common cause of 1004 errors is when you use a named formula or constant in a Range statement. VBA complains because the named formula or constant returns a value rather than a range reference. The workaround is to use the evaluate method to get the value, such as by enclosing in square brackets:

  1. Dim MyVar As Double
  2. Dim cel As Range
  3. Set cel = Range(“SomeNamedConstant”) ‘Causes run-time error 1004
  4. MyVar = [SomeNamedConstant] ‘This works.
    Note the lack of double-quotes

4. Check the contents of the spreadsheet

  • Inserting a row or column
  • Performing calculations
  • Copy and pasting
  • Sorting
  • Opening or closing the workbook

If you are doing any of the actions mentioned above and you receive the error, check what exactly is wrong. If that is the case, try doing the following:

  • Recheck the formulas
  • Recheck the calculations
  • Avoid using excess shapes
  • Avoid using complex PivotTables
  • Try not to use macros and complex charts with many data points

In today’s guide, we explored the best solutions that you can try to fix the VBA runtime error 1004.

If you found this article helpful or you have any suggestions, get into contact with us by using the comment section below.

idee restoro Still having issues? Fix them with this tool:
  1. Download this PC Repair Tool rated Great on (download starts on this page).
  2. Click Start Scan to find Windows issues that could be causing PC problems.
  3. Click Repair All to fix issues with Patented Technologies (Exclusive Discount for our readers).

Restoro has been downloaded by 0 readers this month.

Frequently Asked Questions

  • VBA stands for Visual Basic for Applications. Excel VBA is Microsoft’s programming language for Excel.

  • There are three types of VBA errors that you may encounter when executing an Excel macro. These compile errorsruntime errors, and logical errors (bugs).

  • Runtime errors occur during the execution of your code and cause the code to stop running. For example, if your code attempts to divide by zero, you will be presented with a message box, which states Run-time error 11: Division by zero.

This article covers:Topics: