View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jay Jay is offline
external usenet poster
 
Posts: 671
Default Referencing a Chart on a Worksheet

Hello all,

I've got a problem that is driving me up the wall. All my searches have
proved fruitless, so I'm hoping someone smarter can answer my question, or
point me to a post that answers it.

I've trying to change the data source of a chart in VBA. All the previous
code used:
ActiveChart.SeriesCollection.Count

I'm trying to use an actual reference to the chart so it doesn't have to be
selected. What I can't do is reference the SeriesCollection of the chart.
Everything I try gets me a "subscript out of range" error.

It would look like this:
Worksheets(SHEETNAME).ChartObjects(1).Chart.Series Collection.Count

Or so I thought. This isn't a chart IN a worksheet, but a chart that IS a
worksheet. I can't find any way to point to the chart without selecting the
chart and using ActiveChart. Recording a macro isn't helping, it used
ActiveChart as well.

Any ideas you might have are appreciated. I'll try anything.

Thanks,
Jay