J
J S
I have a chart in a worksheet, the chart is a stacked column chart with 6
series and I want to programmatically changed the names of each of the data
series. I can do this just fine if I do it manually. When I use the macro
recorder and try to run the recorded code I get the Following error: 1004
Unable to set the Name property of the Series class
I have no idea why this is the case, Interestingly enough when I use the on
error resume next, I find that I am able to change the name of the first
series and the sixth series with no problems but data series 2-5 all
generate the same error.
I am using excel 2000 on windows xp pro.
If anybody would like a sample spreadsheet that demonstrates this problem
let me. The sample code I used is pasted below.
-J
Sub Macro1()
On Error Resume Next
Sheets("Acquisition (Donor Value)").Select
ActiveSheet.ChartObjects("Chart 2").Activate
ActiveChart.SeriesCollection(1).Name = "=""a1"""
Debug.Print "#1 " & Err.Number & " " & Err.Description
Err.Clear
ActiveChart.SeriesCollection(2).Name = "=""a2"""
Debug.Print "#2 " & Err.Number & " " & Err.Description
Err.Clear
ActiveChart.SeriesCollection(3).Name = "=""a3"""
Debug.Print "#3 " & Err.Number
Err.Clear
ActiveChart.SeriesCollection(4).Name = "=""a4"""
Debug.Print "#4 " & Err.Number
Err.Clear
ActiveChart.SeriesCollection(5).Name = "=""a5"""
Debug.Print "#5 " & Err.Number
Err.Clear
ActiveChart.SeriesCollection(6).Name = "=""a6"""
Debug.Print "#6 " & Err.Number
Err.Clear
End Sub
series and I want to programmatically changed the names of each of the data
series. I can do this just fine if I do it manually. When I use the macro
recorder and try to run the recorded code I get the Following error: 1004
Unable to set the Name property of the Series class
I have no idea why this is the case, Interestingly enough when I use the on
error resume next, I find that I am able to change the name of the first
series and the sixth series with no problems but data series 2-5 all
generate the same error.
I am using excel 2000 on windows xp pro.
If anybody would like a sample spreadsheet that demonstrates this problem
let me. The sample code I used is pasted below.
-J
Sub Macro1()
On Error Resume Next
Sheets("Acquisition (Donor Value)").Select
ActiveSheet.ChartObjects("Chart 2").Activate
ActiveChart.SeriesCollection(1).Name = "=""a1"""
Debug.Print "#1 " & Err.Number & " " & Err.Description
Err.Clear
ActiveChart.SeriesCollection(2).Name = "=""a2"""
Debug.Print "#2 " & Err.Number & " " & Err.Description
Err.Clear
ActiveChart.SeriesCollection(3).Name = "=""a3"""
Debug.Print "#3 " & Err.Number
Err.Clear
ActiveChart.SeriesCollection(4).Name = "=""a4"""
Debug.Print "#4 " & Err.Number
Err.Clear
ActiveChart.SeriesCollection(5).Name = "=""a5"""
Debug.Print "#5 " & Err.Number
Err.Clear
ActiveChart.SeriesCollection(6).Name = "=""a6"""
Debug.Print "#6 " & Err.Number
Err.Clear
End Sub