How to Fix VBA Run-Time Error 424 When Looping Through Charts
Question details
The user needs to resolve an Object required error that occurs when executing a macro that loops through chart data.

- Product
- Spreadsheets
- Device & OS
- not provided
- Scenario
- Running a VBA macro script intended to iterate through chart series values or properties.
- Observed behavior
- The macro execution halts, displaying Run-Time Error 424: Object required, often because series values are mistakenly treated as Range objects or variables are missing explicit references.
Open your Visual Basic Editor by pressing Alt + F11 and use the debugging tool to highlight the exact line of code triggering the 'Object required' error before making changes.
Handle Series.Values as an Array Instead of a Range
Because the Series.Values property returns an array rather than a Range object, attempting to assign it to a Range triggers Error 424. Assign the values to a Variant array instead.
A common mistake when working with charts in VBA is assuming that the data feeding a chart series operates exactly like worksheet cells. The Series.Values property evaluates the data and outputs an array of values. If your code uses the 'Set' keyword or declares the receiving variable as a Range, the compiler will demand an object, leading to Error 424.
Find the line in your VBA macro where you are attempting to retrieve ActiveChart.SeriesCollection(1).Values.
Modify the variable declaration from 'Dim myValues As Range' to 'Dim myValues As Variant'.
Remove the 'Set' keyword if it is present. Assign the array using standard assignment: 'myValues = ActiveChart.SeriesCollection(1).Values'.
Iterate through the extracted chart values using a standard loop structure such as 'For i = LBound(myValues) To UBound(myValues)'.
Fully Qualify Worksheet and Chart References
Implicit references that rely on the ActiveSheet can fail if the focus shifts during code execution, leading to missing objects. Explicitly defining the worksheet and chart objects prevents Error 424.
Debug and Run VBA Macros Seamlessly with WPS Spreadsheet
WPS Office offers a robust Spreadsheet application with comprehensive built-in support for VBA macros. You can easily write, edit, and debug your chart macros with high compatibility and performance.
- 1. Download and Install WPS Office: Install WPS Office and open your macro-enabled spreadsheet file.
- 2. Access the Developer Tab: Navigate to the Developer tab on the top ribbon and click on 'Visual Basic' to launch the integrated editor.
- 3. Implement the Fixes: Locate your chart looping macro module and update the code to use Variant arrays and fully qualified object paths.
- 4. Run the Macro: Click 'Run' or press F5 in the editor to execute the corrected chart loop seamlessly.

Frequently Asked Questions
What does VBA Run-Time Error 424 mean?
Run-Time Error 424 'Object required' means the VBA code is attempting to use a property, method, or the 'Set' command on a variable that has not been properly instantiated as a valid object, such as trying to treat an array of basic values as a Worksheet Range.
Why does Series.Values cause an Object Required error?
The Series.Values property intrinsically returns an array of the underlying chart data points, not a Worksheet Range object. If your code declares the receiving variable as a Range or uses the 'Set' keyword, VBA throws an object requirement mismatch.
Can I retrieve the original Range address from a chart series?
Yes. While Series.Values gives you the data directly, you can parse the Series.Formula property using standard string manipulation to extract the actual worksheet range address used for the series data, which you can subsequently bind to a Range object.




