Excel VBA Runtime Error 424: Object Required

VBA & macros · Updated November 19, 2026

Excel VBA Run-time error ‘424’: Object required means a line of code is using a value where VBA expects an object, such as a worksheet, range, or workbook. Click Debug when the error appears to highlight the failing line, then check whether each object reference on that line actually refers to an object.

What error 424 means

VBA objects represent things Excel can work with: a Workbook, Worksheet, Range, chart, or control, for example. Error 424 occurs when an operation requires one of these objects but the expression supplied is instead a value, a missing reference, or something VBA cannot treat as an object. The exact cause depends on the highlighted statement and the expressions it contains.

A useful distinction is that a cell’s Range is an object, but the cell’s Value is usually a number, text, a date, a Boolean value, or an error value. If code expects a Range object and receives the cell’s value instead, the two are not interchangeable. Similarly, a worksheet name written in a string is not itself a worksheet object; code must use the string to retrieve the worksheet from a workbook’s collection.

The error is not necessarily evidence that Excel is damaged or that a workbook is corrupt. In many cases, it points to one incorrect expression in a macro. It can also reveal that a variable or property has a different type or meaning than the code assumes.

How VBA object references work

VBA distinguishes between assigning a value and assigning an object reference. A statement that sets a variable to a Range object needs the Set keyword. By contrast, assigning a cell’s contents to a variable is an ordinary value assignment. A common source of confusion is assuming that a reference to a cell and the value stored in that cell are the same thing.

For example, the expression Worksheets("Data").Range("A1") refers to a Range object, while Worksheets("Data").Range("A1").Value returns the cell’s contents. A statement that uses Set needs an object on its right-hand side. If that expression ends in .Value and the cell contains ordinary text or a number, it supplies a value rather than a Range object.

Object variables also need to be assigned a reference before the code uses them. A variable declared as a Range does not automatically point to a cell. This related mistake often produces error 91, “Object variable or With block variable not set,” rather than error 424. The distinction is helpful: 424 often means the expression is the wrong kind of thing; 91 often means an object variable has no reference.

Common causes in Excel macros

  • Using a value where an object is required: A cell’s .Value is assigned to an object variable with Set, or a method that requires a Range is given a cell’s contents instead.
  • Using a property as though it were an object: Some properties return values, not objects. Check the property’s purpose rather than assuming that every part of a dotted expression is an object reference.
  • Confusing an object name with text: The string "Data" is only a worksheet name. To get the worksheet object, use it as an item in a workbook’s Worksheets collection.
  • Leaving an object variable unassigned: Declaring Dim ws As Worksheet declares a variable but does not connect it to a worksheet. Assign an actual worksheet with Set before using the variable. As noted above, using an unassigned variable more commonly raises error 91.
  • Misunderstanding a With block: A leading period refers to a member of the object named by With. Without the period, the statement may instead refer to a different object or name in scope, producing unexpected behavior or an error.
  • Using the wrong object model: A control on a worksheet, a control on a UserForm, and a worksheet cell are different kinds of objects. Their properties and methods are not automatically interchangeable.

A missing workbook or worksheet is another clue to investigate, but it does not always cause error 424. For example, requesting a nonexistent item from a collection commonly produces a different error. Do not assume that every bad sheet reference has the same cause; inspect the actual error number and the failing expression.

Find the failing expression step by step

  1. When the error dialog appears, choose Debug. VBA normally highlights the statement where execution stopped. If the dialog has no Debug option, the macro may be running in a context that does not allow breaking into the code.
  2. Read the whole highlighted statement, especially each dot-separated part. Work from left to right: identify the workbook, worksheet, range, property, and method involved.
  3. Check variable declarations and assignments. Confirm that an object variable is declared with the intended type, assigned with Set, and assigned before the failing line runs.
  4. Inspect the right-hand side of every Set statement. It must evaluate to an object. If the expression ends in a value-returning property such as .Value, that may be the mismatch.
  5. Use the Visual Basic Editor’s debugging tools to step through the procedure and inspect variable values. On Windows, press F8 to step through code in the editor. You can also hover over a variable while execution is paused or use the Locals and Watch windows.

In Microsoft 365 for Windows, open the editor with Developer > Visual Basic, or press Alt+F11. If the Developer tab is missing, enable it through File > Options > Customize Ribbon. Excel for Mac also includes the Visual Basic Editor, available from the Developer tab; keyboard shortcuts can depend on the Mac’s function-key settings. Excel for the web cannot run VBA macros, so use the desktop app to debug them.

Correct object assignments and qualify references

Use explicit object types where practical and assign them before use. Fully qualifying a worksheet through ThisWorkbook also makes it clear which workbook the code intends to use. ThisWorkbook means the workbook containing the VBA code; ActiveWorkbook means whichever workbook is active at that moment, which may be a different file.

For instance, if the workbook has a sheet named Data, the following procedure assigns a Range object to the variable and prints the cell’s value. It will only run as written if that worksheet exists in the workbook containing the code.

Option Explicit

Sub ReadCell()
    Dim cell As Range

    ' Assign the Range object, not the cell's value.
    Set cell = ThisWorkbook.Worksheets("Data").Range("A1")
    Debug.Print cell.Value
End Sub

Before running any macro that changes workbook contents, save a separate copy of the workbook. VBA actions cannot be undone with Ctrl+Z. This particular example only prints a value in the Immediate window, but the habit matters when adapting sample code to edit cells or other workbook objects.

For a With block, put a period before each member intended to belong to the specified worksheet. This example copies the value in A2 to B2 on the Data sheet:

Option Explicit

Sub CopyCellValue()
    Dim ws As Worksheet

    ' Bind the variable to a worksheet in this workbook.
    Set ws = ThisWorkbook.Worksheets("Data")

    ' The leading periods refer to members of ws.
    With ws
        .Range("B2").Value = .Range("A2").Value
    End With
End Sub

Again, save a copy before running code that changes cells, because macro changes are not reversed by Ctrl+Z. Qualifying references is especially valuable when multiple workbooks are open: an unqualified Range or Worksheets reference can depend on the active sheet or workbook, rather than the file the procedure’s author intended.

Related errors and what they suggest

Error 424 is easy to confuse with other VBA errors. The number and wording are useful clues, but the highlighted line still matters. A few common distinctions are:

  • Error 91: An object variable or With block variable has not been set. Look for a variable declared as an object but not assigned a reference before use.
  • Error 438: The object does not support the property or method being called. The expression may be an object, but it may be the wrong kind of object for that member.
  • Error 13: Type mismatch. A value or object may not match the declared or expected type.
  • Error 9: Subscript out of range. A requested collection item, such as a workbook or worksheet by name or index, may not exist in that collection.

These are common patterns, not guaranteed diagnoses. A single line can contain several expressions, and fixing one problem may expose another. For example, after correcting a value-versus-object mismatch, code may proceed far enough to reveal that the worksheet name is misspelled.

Preventing error 424 in future code

Several habits make object-related bugs easier to prevent and diagnose:

  • Put Option Explicit at the top of each module and declare variables. It helps VBA catch misspelled or undeclared variable names during compilation.
  • Use specific types such as Worksheet and Range instead of a generic Object when the object type is known. Specific types make the code’s intent clearer.
  • Use Set when assigning an object reference, and do not use it when assigning ordinary values such as cell contents.
  • Qualify workbook and worksheet references instead of relying on whichever workbook or sheet happens to be active.
  • Break complicated expressions into a few named variables. That makes it easier to see which part returns an object and which part returns a value.
  • Run Debug > Compile VBAProject in the Visual Basic Editor to catch compile-time problems. Compilation cannot detect every runtime mistake, but it can identify some declaration and syntax problems before a macro runs.

Frequently Asked Questions

What does Object required mean in Excel VBA?
It means VBA encountered an operation that requires an object but was given something that is not an object, or an expression that cannot be used as one. Check the highlighted line for a value being used where a workbook, worksheet, range, or other object is expected.

Does error 424 always mean I forgot Set?
No. Set is required to assign an object reference, but error 424 can also arise from using a value-returning property where an object is required or from another invalid object expression. Also, an unassigned object variable often causes error 91 instead.

How do I find which line caused runtime error 424?
Choose Debug in the error dialog. VBA highlights the statement where execution stopped. Then inspect the full statement and check its object references and properties. Step through it with F8 in the Visual Basic Editor on Windows.

Can I run VBA macros in Excel for the web?
No. Excel for the web does not run VBA macros. Open the workbook in desktop Excel for Windows or Mac to run and debug VBA. The available VBA object model can differ in some areas between Windows and Mac.

Will Ctrl+Z undo a macro that caused error 424?
No. Excel’s normal Undo history does not undo VBA macro actions. Save a copy before running code that changes data, and use a backup or a deliberate recovery method if a macro has already altered the workbook.

Related

Try it: the Column Letter to Number: aA is 27, XFD is 16,384. Converts both ways.

More in VBA & macros

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.