Strat121
Technical User
- Jun 11, 2008
- 11
Having issues getting the program to recognize the series collection name for a graph:
Count = 1
For Each wSheet In Worksheets
If wSheet.Name <> ActiveSheet.Name Then
Count = Count + 1
ElseIf wSheet.Name = ActiveSheet.Name Then
Exit For
End If
Next wSheet
Sheets("Graph").Select
ActiveChart.SeriesCollection(Count).Name = Worksheets(Count).Name
It works perfectly the first time around. But if I delete the active sheet, then insert a new worksheet with the same name and same data, it gives me the run-time 1004 "Unable to set Name property of Series class" error.
Count = 1
For Each wSheet In Worksheets
If wSheet.Name <> ActiveSheet.Name Then
Count = Count + 1
ElseIf wSheet.Name = ActiveSheet.Name Then
Exit For
End If
Next wSheet
Sheets("Graph").Select
ActiveChart.SeriesCollection(Count).Name = Worksheets(Count).Name
It works perfectly the first time around. But if I delete the active sheet, then insert a new worksheet with the same name and same data, it gives me the run-time 1004 "Unable to set Name property of Series class" error.