Getting Run-time error '5': Invalid Procedure Call or argument when trying to run this VBA

38 Views Asked by At

Can someone (in "dumbed down" non developer language) tell me why this code doesn't work?

I copied the base from someone else (which apparently works, because that person replied to someone else in a forum).

My code which doesn't work:

Private Sub Worksheet_PivotTableUpdate()
    ActiveSheet.ChartObjects("Decom_Chart").Activate
    ActiveCharts.SeriesCollection("Count of Decomm Parent Ticket").ChartType = xlColumnClustered
    On Error Resume Next
    ActiveChart.FullSeriesCollection("Average of Pending Since").ChartType = xlLine
    ActiveChart.Deselect
End Sub

Their code which does work:

Private Sub Worksheet_Calculate()
    ActiveSheet.ChartObjects("Chart 3").Activate
    ActiveChart.FullSeriesCollection(1).ChartType = xlColumnStacked
    On Error Resume Next
    ActiveChart.FullSeriesCollection("Limit").ChartType = xlLine
    ActiveChart.Deselect
End Sub

I don't see any difference (other than the names of worksheet tabs and series names) that would make mine not work?

I'm no expert at VBA, try to avoid having to use it at all costs (because this is not something I need to deal with very often), so any help is appreciated.

0

There are 0 best solutions below