Runtime Error 424: Object Required (Common in UserForm control references).

VBA raises Runtime Error 424: Object Required when code attempts to access a property, method, or control name as if it were an object, but Excel evaluates the expression as empty, a primitive value, or an uninstantiated variable. In UserForms, this typically happens when a control name is misspelled, when code references a control that has not been initialized, or when a developer forgets the Set keyword when assigning an object reference.

Quick Answer

To resolve Runtime Error 424, check the spelling of your UserForm control names against the (Name) field in the Properties window, use the Me. keyword inside UserForm code modules for IntelliSense validation, and ensure all object assignments explicitly use the Set statement (for example, Set myRange = Range("A1") instead of myRange = Range("A1")).


Why “Object Required” Happens

In VBA, data falls into two fundamental categories:

  1. Values (Primitive Types): Numbers, strings, Booleans, dates (Long, String, Boolean, Double).
  2. Objects: Pointers to structures in memory (Workbook, Worksheet, Range, UserForm, TextBox, CommandButton).

When you write a statement that demands an object reference—such as reading a property (.Text, .Value, .Caption) or invoking a method—VBA expects an instantiated pointer. If what you supplied evaluates to a non-object or an undeclared variant, the execution halts with Error 424.

' Example 1: Omitting Set
Dim rng As Range
rng = Worksheets("Data").Range("A1") ' FAILS: Error 424. Range is an object; requires Set.

' Example 2: Misspelled UserForm Control
UserForm1.TxtUserName.Text = "Admin" ' FAILS: If the actual control name is txtUser_Name.

If your macro encounters missing references while assigning collections or variables, review the broader logic guide in Runtime Error 91: Object variable or With block variable not set (The Set keyword trap)..


Key Causes in UserForm Environments

1. Misspelled Control Names and Missing Me. Qualification

Inside a UserForm code module, writing an unadorned name like txtLastName.Value = "" relies on VBA finding an exact match in the project scope. If the control was renamed (e.g., to txt_LastName), VBA assumes the undeclared identifier is an empty Variant, which has no properties or methods.

  • Fix: Always prefix controls with Me. inside UserForms. The Me keyword points directly to the current form instance and enables IntelliSense:
Private Sub btnSubmit_Click()
    ' Typing "Me." brings up the autocomplete dropdown.
    ' If your control is not in the list, it does not exist or is misspelled.
    If Trim(Me.txtLastName.Text) = "" Then
        MsgBox "Please enter a last name.", vbExclamation
        Exit Sub
    End If
End Sub

2. Referencing Controls on Unloaded Forms

If you try to read values from a UserForm that has already been dismissed using Unload Me, the underlying object reference is destroyed:

' Fragile practice:
Unload UserForm1
MsgBox UserForm1.txtInput.Text ' FAILS: Error 424; UserForm1 controls no longer exist in memory.

' Robust practice:
UserForm1.Hide ' Hides the form visually while preserving control values in memory
MsgBox UserForm1.txtInput.Text
Unload UserForm1 ' Unload only after values are captured

For validation techniques prior to form unloading, see Handling errors in UserForms: Validating text box input before it breaks the code..

3. Omitting the Set Keyword on Object Assignment

Attempting to bind a worksheet or range variable without Set is one of the most common causes of Error 424:

' Incorrect:
Dim targetSheet As Worksheet
targetSheet = ThisWorkbook.Worksheets("Data") ' Error 424

' Correct:
Dim targetSheet As Worksheet
Set targetSheet = ThisWorkbook.Worksheets("Data")