Hi,
I have a about 12 charts in my worksheet. About 6 charts (Clustered column charts) of them have primary & secondary axis.
I have a macro which align the primary & secondary axes to zero. So far good.
The input of my chart changes and I want to be able to reset the axes value to auto and have a macro for that.
The code works fine for the primary y-axis, but I run into the Method 'Axes' of object '_Chart' failed for the secondary y-axis (highlighted in red and underline in the code below).
How can this be fixed?
Any ideas about how this can be fixed would be very much appreciated.
'Reset the axes values to Automatic
Sub ResetScalesToAuto()
Dim oChrtObj As ChartObject
For Each oChrtObj In Worksheets("ChangeDrivers").ChartObjects
With oChrtObj.Chart
With .Axes(2, 1)
.MinimumScaleIsAuto = True
.MaximumScaleIsAuto = True
End With
With .Axes(2, 2)
.MinimumScaleIsAuto = True
.MaximumScaleIsAuto = True
End With
End With
Next oChrtObj
End Sub
Thanks
Bookmarks