Method AxisGroup failing before scrolling through worksheet

jgmaxus

New Member
Joined
Mar 8, 2016
Messages
1
Very odd problem here. I'm using some basic VBA to update a few charts based on the user's drop down selection. Everything works as intended, so long as you don't try to change your selection upon loading the file right away. If you scroll through the various charts, and then back up to choose a new selection, it's fine. If you try to run an update first, a run-time error '-2147417848 (80010108)' Method 'AxisGroup' of object 'Series' failed. It then deletes the affected chart. I'm updating other charts the same way and it works fine without scrolling through the worksheet first.

Code:
    With ActiveSheet.ChartObjects("Chart 9").Chart
        .HasAxis(xlCategory, xlPrimary) = True
        .SeriesCollection(1).XValues = rcDataOne
        .SeriesCollection(1).Values = rcDataTwo
        
        .SeriesCollection(2).AxisGroup = xlSecondary
        .SeriesCollection(2).XValues = rcDataOne
        .HasAxis(xlCategory, xlSecondary) = False
        .HasAxis(xlValue, xlSecondary) = True
        .SeriesCollection(2).Values = rcDataThree
        
    End With

Thanks for any and all help!
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Forum statistics

Threads
1,214,634
Messages
6,120,659
Members
448,975
Latest member
sweeberry

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top