VBA & Macro Problems

How to Fix VBA Run-Time Error 424 When Looping Through Charts

Emma BrownEmma Brown Oct 21, 2026 869 views

Question details

The user needs to resolve an Object required error that occurs when executing a macro that loops through chart data.

How to Fix VBA Run-Time Error 424 When Looping Through Charts
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.
Before you start

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.

Solution 1Recommended

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.

1
Locate the Variable Assignment

Find the line in your VBA macro where you are attempting to retrieve ActiveChart.SeriesCollection(1).Values.

2
Change the Variable Declaration

Modify the variable declaration from 'Dim myValues As Range' to 'Dim myValues As Variant'.

3
Assign the Values Correctly

Remove the 'Set' keyword if it is present. Assign the array using standard assignment: 'myValues = ActiveChart.SeriesCollection(1).Values'.

4
Loop Through the Array

Iterate through the extracted chart values using a standard loop structure such as 'For i = LBound(myValues) To UBound(myValues)'.

Best Practice: Using a Variant array to process chart data is significantly faster than interacting directly with worksheet ranges during a loop.

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. 1. Download and Install WPS Office: Install WPS Office and open your macro-enabled spreadsheet file.
  2. 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. 3. Implement the Fixes: Locate your chart looping macro module and update the code to use Variant arrays and fully qualified object paths.
  4. 4. Run the Macro: Click 'Run' or press F5 in the editor to execute the corrected chart loop seamlessly.
Native support for VBA macros, scripts, and chart automationHigh format compatibility with Microsoft Excel .xlsm and .xlsb filesFamiliar Developer tab and Visual Basic Editor interfaceLightweight architecture for fast macro execution and data processing
microsoft office alternative - wps office

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.