So... This code was working fine, but now it's not... I am a little stumped.. It works A-OK if there is only 1 chart visible on the worksheet, however if I have 2 charts visible the code stops removing the desired series collection..
Code:
Dim SeriesNum As Integer, CurrSeries As String, i As Integer, cht As Integer, myChart As Chart, SeriesColl As Series
Dim chr As Integer, find As Integer, Row As Integer
On Error Resume Next
For cht = 1 To Sheet3.ChartObjects.Count
If Sheet3.ChartObjects(cht).Visible = True Then
Sheet3.ChartObjects(cht).Activate
For Each SeriesColl In ActiveChart.SeriesCollection
If SeriesColl.Name = CurrSeries Then
SeriesColl.Delete
End If
Debug.Print CurrSeries
Debug.Print SeriesColl.Name
Next SeriesColl
End If
Next cht
Immediate Window:
All Sites All Departments (Feb-2014)
All Sites All Departments (Feb-2014)
labelTracker Chart_Kicker Health 1
All Sites All Departments (Feb-2014)
All Sites All Departments (Jan-2014)
labelTracker Chart_Kicker Health 1
All Sites All Departments (Feb-2014)
All Sites All Departments (Feb-2014)
labelTracker Chart_Kicker Health 2
All Sites All Departments (Feb-2014)
All Sites All Departments (Jan-2014)
labelTracker Chart_Kicker Health 2
'End Immediate Window Output
Couple strange items to note...
Sheet3 name is not "labelTracker"
the worksheet named "labelTracker" has no charts.
There are 2 charts visible on sheet 3 when code runs, called "Chart_Kicker Health 1" and "Chart_Kicker Health 2". Both charts have 2 data series which were loaded via VBA, however based on the immediate window output it looks like each series is counting twice...
Anyone have any ideas what's going on here? I rebooted my pc several times thinking there might be a mem leak or something like that occuring but the issue persists..