logo
search
VBA & Macro Problems

Fix Excel VBA Run-Time Error 424 (Object Required) in Class Method

Huda QurayshiHuda Qurayshi Sep 28, 2026 869 views

Question details

The user is encountering Run-time error 424 (Object required) when calling a VBA class method to format Range borders.

How to Fix Excel VBA Run-Time Error 424 (Object Required) in a Class Method
Product
Excel VBA
Device & OS
not provided
Scenario
Passing a named range or object variable as an argument to a custom subroutine (class method) in an Excel VBA macro.
Observed behavior
The macro throws an "Object required" error because the method is called with parentheses around the argument, which forces VBA to evaluate the object as an expression.
Before you start

Verify that your named range or variable actually contains a valid Range object and has been properly initialized before debugging the method call syntax.

Solution 1Recommended

Remove Parentheses When Calling the Subroutine

The standard way to call a Sub in VBA with arguments is without parentheses. Using parentheses forces VBA to evaluate the variable as a value expression rather than passing the object reference.

In VBA, parentheses are only required when a routine returns a value to a variable (like a Function) or when you explicitly use the 'Call' keyword. If you wrap an object argument in parentheses for a standard Sub call, VBA attempts to evaluate it, stripping away its object nature and triggering Error 424.

1
Locate the method call

Open your Visual Basic Editor and find the line of code that triggers the error, such as: Bor.Summary_Outline_Borders (Variant_Summary).

2
Remove the parentheses

Delete the parentheses surrounding your object argument. The corrected syntax should look like: Bor.Summary_Outline_Borders Variant_Summary.

3
Run the macro

Execute your code again to confirm that the Range object is successfully passed and the error is resolved.

Remove Parentheses When Calling the Subroutine
Syntax Rule: Only use parentheses when assigning a Function's return value to a variable (e.g., boolRet = FTest(Range("A1"))).

Write and Run VBA Macros Seamlessly in WPS Office

WPS Office provides robust built-in support for VBA and macros. You can automate complex tasks, execute your existing Excel macro scripts without modification, and enjoy a powerful spreadsheet environment.

  1. 1. Open WPS Spreadsheet: Launch WPS Office and open your macro-enabled spreadsheet file.
  2. 2. Access Macro Tools: Navigate to the 'Tools' or 'Developer' tab on the top ribbon and select 'Macros'.
  3. 3. Open the VBA Editor: Click on 'Visual Basic Editor' to view, edit, and debug your class methods and subroutines.
  4. 4. Correct the Syntax: Adjust your code to omit parentheses when calling Subs with object arguments, ensuring proper VBA syntax.
  5. 5. Run the Macro: Click 'Run' or press F5 to execute your automated tasks without encountering object errors.
Highly compatible with Microsoft Excel macro-enabled files (.xlsm)Built-in VBA editor to seamlessly create, debug, and run custom scriptsFree, lightweight, and easy-to-use alternative with a familiar interface
microsoft office alternative - wps office

Frequently Asked Questions

Why does adding parentheses cause Error 424 in VBA?

In VBA, adding parentheses around an argument when calling a Sub tells the program to evaluate the argument as a value expression rather than passing the object by reference. Since an evaluated expression is not an object, VBA expects an object and throws Run-time error 424.

When should I use parentheses in Excel VBA?

You should use parentheses when you are calling a Function that returns a value to a variable (e.g., Result = MyFunction(Argument)), or when you explicitly start the line with the 'Call' keyword (e.g., Call MySub(Argument)).

What are other common causes of Run-time Error 424?

Aside from syntax errors with parentheses, Error 424 typically occurs when you forget to use the 'Set' keyword to assign an object to a variable, misspell an object's name, or reference a worksheet or control that does not exist.