In the snippet below, the selected sheet is a chart sheet. Code has started crashing on the [.SeriesCollection(1).Name =] line with the message "Unable to set the Name property of the Series class" even after successfully setting the Values property. The named range "S2Name" does exist. What am I missing here?
Thanks....Tom
Private Sub YTDUtilChartSetup()
Sheets("YTDUtilChart").Select
With ActiveChart
'Remove existing series to avoid errors due to lost references
i = .SeriesCollection.Count
Do Until i < 1
.SeriesCollection(i).Delete
i = i - 1
Loop
'Add new series for Normalized Utilization
.SeriesCollection.NewSeries
.SeriesCollection(1).Values = _
"=Summary!" & Range("YTDSeries2").Address(ReferenceStyle:=xlR1C1)
.SeriesCollection(1).Name = _
"=Summary!" & Range("S2Name").Address(ReferenceStyle:=xlR1C1)
.SeriesCollection(1).XValues = _
"=Summary!" & Range("ArchiveDateRange").Address(ReferenceStyle:=xlR1C1)
Thanks....Tom
Private Sub YTDUtilChartSetup()
Sheets("YTDUtilChart").Select
With ActiveChart
'Remove existing series to avoid errors due to lost references
i = .SeriesCollection.Count
Do Until i < 1
.SeriesCollection(i).Delete
i = i - 1
Loop
'Add new series for Normalized Utilization
.SeriesCollection.NewSeries
.SeriesCollection(1).Values = _
"=Summary!" & Range("YTDSeries2").Address(ReferenceStyle:=xlR1C1)
.SeriesCollection(1).Name = _
"=Summary!" & Range("S2Name").Address(ReferenceStyle:=xlR1C1)
.SeriesCollection(1).XValues = _
"=Summary!" & Range("ArchiveDateRange").Address(ReferenceStyle:=xlR1C1)