Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Sean Curry
 
Posts: n/a
Default Problem adding Series XValues to Chart using VBA

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I display multiple series in a pie chart? AncientPC Charts and Charting in Excel 3 May 3rd 23 05:09 PM
Plotting different length series in a chart Big Red Charts and Charting in Excel 2 May 5th 05 02:00 PM
Dynamic series in Chart Jeff Charts and Charting in Excel 2 February 24th 05 11:54 AM
How to change the color of all series in an excel chart in one go. Mz2 Charts and Charting in Excel 1 January 20th 05 01:07 AM
Help! I'm losing one series of data in an overlay chart. Charts are Us Charts and Charting in Excel 1 January 4th 05 05:57 PM


All times are GMT +1. The time now is 05:26 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"