Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
I have an intermittent and vexing problem trying to add new series to a Chart
using Excel 2002 VBA. Here's a snippet: For i = 1 To NumSeries DataCol = ChartData(k).SeriesParam(i).DataCol Set rgY = Sheets("Appointment Efficiency").Range(ActiveSheet.Cells(StartRow, DataCol), ActiveSheet.Cells(ActiveRow, DataCol)) Set rgX = Sheets("Appointment Efficiency").Range(ActiveSheet.Cells(StartRow, 2), ActiveSheet.Cells(ActiveRow, 2)) scSeries.NewSeries scSeries(i).XValues = rgX scSeries(i).Values = rgY scSeries(i).Name = ChartData(k).SeriesParam(i).SeriesName This crashes with a Runtime Error : "Method 'XValues' of Object 'Series' failed" *most* of the time. Sometimes it runs fine. When it crashes, Excel hangs and I have to kill it. I have tried all variants of the range object for the X values, including just typing a static range for testing. A little more background - the chart already exists, and I delete existing series from it before adding the new ones back. The YValues add fine if I just comment out the XValues line. Everything else works great - point labels, line types, etc all set using VBA. Any help/suggestions would be much appreciated. Thanks, Sean |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How can I display multiple series in a pie chart? | Charts and Charting in Excel | |||
Plotting different length series in a chart | Charts and Charting in Excel | |||
Dynamic series in Chart | Charts and Charting in Excel | |||
How to change the color of all series in an excel chart in one go. | Charts and Charting in Excel | |||
Help! I'm losing one series of data in an overlay chart. | Charts and Charting in Excel |