Fix Excel VBA Run-Time Error 424 (Object Required) in Class Method
Question details
The user is encountering Run-time error 424 (Object required) when calling a VBA class method to format Range borders.

- 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.
Verify that your named range or variable actually contains a valid Range object and has been properly initialized before debugging the method call syntax.
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.
Open your Visual Basic Editor and find the line of code that triggers the error, such as: Bor.Summary_Outline_Borders (Variant_Summary).
Delete the parentheses surrounding your object argument. The corrected syntax should look like: Bor.Summary_Outline_Borders Variant_Summary.
Execute your code again to confirm that the Range object is successfully passed and the error is resolved.

Use the 'Call' Statement
If you prefer the readability of using parentheses around arguments, you must explicitly use the 'Call' keyword.
Ensure Proper Object Initialization
Run-time error 424 can also occur if the variable you are passing is empty or has not been assigned as an object.
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. Open WPS Spreadsheet: Launch WPS Office and open your macro-enabled spreadsheet file.
- 2. Access Macro Tools: Navigate to the 'Tools' or 'Developer' tab on the top ribbon and select 'Macros'.
- 3. Open the VBA Editor: Click on 'Visual Basic Editor' to view, edit, and debug your class methods and subroutines.
- 4. Correct the Syntax: Adjust your code to omit parentheses when calling Subs with object arguments, ensuring proper VBA syntax.
- 5. Run the Macro: Click 'Run' or press F5 to execute your automated tasks without encountering object errors.

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.




