How to Fix Runtime Error 424 "Object Required" VBA in Excel

The Runtime error 424: Object required occurs when Excel is not able to recognize an object that you are referring to in a VBA code. The object can be a workbook, worksheet, range, variable, class, macro, etc. Some users have also reported that this error occurred when they tried to copy the values of the cells from one workbook to another.

Let’s understand the error through a small scenario. Suppose, I want to check the last field row in a table in a spreadsheet named “First” using the VBA code. To do this, I have added a command button and double-clicked on it and entered the below code in the backend:

Private Sub CommandButton2_Click()

Dim LRow As Integer

LRow = Worksheets("First").Cells(Rows.Count, 2).End(xlUp).Row

MsgBox ("Last Row " & LRow)

End Sub

 

Code On Command Button

In this code, Worksheets("First") is a data object. If I mistakenly delete this data object and insert any random name (for example - kanada), then it will not be recognized by Excel. When I run this code, I will get the “Run-time error 424”.

Runtime Error with scenario
 

Causes of Runtime Error 424 in Excel

The Runtime error 424: Object required can occur due to the following reasons:

  • Incorrect name of the object you are trying to refer to in a code.
  • You have provided an invalid qualifier to an object.
  • You have not used the Set statement while assigning an object reference.
  • The object is corrupted.
  • Missing objects in a workbook.
  • Objects you are trying to call in a code are mistakenly deleted or unavailable.
  • You have used an incorrect syntax for object declaration.
  • You are trying to perform an invalid action on an object in a code.
  • Workbook is corrupted.

 Solutions to Fix Runtime Error 424: Object Required in Excel

The VBA error ‘object required’ may occur due to different reasons. Based on the reason, you can follow the solutions mentioned below to fix the error.

1. Check the Name of the Object

The Runtime error 424 can occur when you run the VBA code using an incorrect name of the object. For example, the object name is ‘MyObject’ but you’re using “Backcolor”.

 

Error When Incorrect Name Of The Object

 When you click the Debug button, the line with the error will highlight.

 

Highlighting Line With Error

To fix the issue, you need to provide the correct name of the object.

2. Check if the Object is Missing

 The Runtime error 424 can occur if the object you are referring to as a method is not available or you are using the wrong object in a code. In the below example, you can see that the error occurs when an object named “Employee” is not available in the Project list.

 

Example Of Code When Object Is Not Available

 You can check and mention the object which is available. For instance, Sheet2 in the below code.

Check When The Object Is Available

3. Check All References are Declared in the Code

You can get the Runtime error 424 if all the references are not declared. So, make sure you have declared all the references in the code. To verify this, you can use the debug mode by pressing F5 or clicking on the Debug option.

 

Debug Command In Excel

4. Check the Macro Security Settings 

Sometimes, the error can occur if macros are disabled in the Macro Security settings. You can check and change the settings by following these steps:

  • On the Developer tab, in the Code section, click Macro Security.
  • In the Trust Center window, select Enable all macros.

 

Macro Security Wizard

  • Click OK.

 

Enable All Macro In Trust Center

5. Repair your Workbook

Sometimes, the ‘Object required’ error can occur if your Excel file is damaged or corrupted. In such a case, you can try repairing the file using Microsoft’s in-built utility - Open and Repair. To use this utility, follow these steps:

  • In Excel, go to File > Open > Browse
  • In the Open dialog box, click on the corrupted Excel file. 
  • Click the arrow next to the Open button and select Open and Repair from the dropdown.
  • Select Repair to recover as much data from the file as possible.

If the Open and Repair utility fails or stops working, then you can try a professional Excel repair tool, such as Stellar Repair for Excel. It is an advanced tool that can repair severely corrupted Excel files (.xls, .xlsx, .xltm, .xltx, and .xlsm). It helps recover all the file components, including images, charts, tables, pivot tables, cell comments, chart sheets, formulas, etc., without impacting the original structure. 

Conclusion

The Runtime error 424 usually occurs when there is an issue with the objects in your VBA code. In this article, we have covered some effective methods to resolve the “object required” error in Excel. If the error occurs due to corruption in Excel file, then you can repair the corrupt file using Stellar Repair for Excel. It is a reliable tool that can repair severely corrupted Excel file without changing its actual formatting. You can download the free trial version of the software to evaluate its functionality.



Was this article helpful?
About The Author
author image
Monika Dadool linkdin Icon

Monika Dadool is a Technical content writer at Stellar who writes about QuickBooks, Sage50, MySQL Database, Active Directory, e-mail recovery, Microsoft365, Pattern Recognition, and Machine learning. She loves researching, exploring new technology, and Developing engaging technical blogs that help organizations or Database Administrators fix multiple issues.

Table of Contents

WHY STELLAR® IS GLOBAL LEADER

Why Choose Stellar?
  • 0M+

    Customers

  • 0+

    Years of Excellence

  • 0+

    R&D Engineers

  • 0+

    Countries

  • 0+

    PARTNERS

  • 0+

    Awards Received