"Peter T" <peter_t@discussions wrote in message
...
Hi Kate,
You need to qualify 'Cells' to the relevant worksheet, eg
ActiveChart.SeriesCollection(i).Values = Worksheets(i).Range(Cells(2,
2), Cells(2, 2).End(xlDown).Value)
with Worksheets(i)
ActiveChart.SeriesCollection(i).Values = .Range(.Cells(2,2), .Cells(2,
2).End(xlDown).Value)
end with
note the dot before each .Cells
If your sets of values produces arrays as strings in the series formula
with
more than 240-255 characters the method would fail
BTW, unless you have multiple axes you only need to apply the XValues to
the
first series.
FWIW you could add the range source's to your series instead of arrays of
values (needs a bit of work to convert correctly to a string formula)
Not much work, since you can reference a range instead of building a string:
With Worksheets(i)
ActiveChart.SeriesCollection(i).Values = _
.Range(.Cells(2,2), .Cells(2, 2).End(xlDown))
End With
- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. -
http://PeltierTech.com
_______