![]() |
Error trying to set the name of series in a chart.
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. I will also post another message in reply to this one with the excel spreadsheet and some testing code in a module(which I 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 |
Error trying to set the name of series in a chart.
Unfortunately I can post the sample spreadsheet (The newsserver won't except
it) but if anybody needs one to help diagnose this problem, let me know and I'll email it to you... -J "J S" wrote in message ... 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. I will also post another message in reply to this one with the excel spreadsheet and some testing code in a module(which I 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 |
All times are GMT +1. The time now is 07:38 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com