Series collection pb on Ecxel 2003 chart

D

David

Hi guys, I've got a big pb... and if someone could help me quickly it
would be great.

There's my pb :
I run a macro under VB which create charts and series within each
charts using :


'Creating Chart
'Add serie


'And then:


1.Set AddSingleChartSeriesFromRange =
NewChart.SeriesCollection.NewSeries
2.AddSingleChartSeriesFromRange.Values = "=" &
RangeToChartAddress(ChartSeriesValues)


3.If Not ChartSeriesXValues Is Nothing Then
AddSingleChartSeriesFromRange.XValues = "=" &
RangeToChartAddress(ChartSeriesXValues)


4.If Not ChartSeriesName Is Nothing Then
AddSingleChartSeriesFromRange.Name = "=" &
RangeToChartAddress(ChartSeriesName)


' It does crash just after setting the values...


The thing is, it does work fine for a lot of charts , but somehow
manages to crash for one of the chart ( which can be different
depending of the series of each chart, for that I 'm wondering if
didn't hit any limit within Excel for the series within a
workbook...which might be 256 but it is written 255 on a worksheet on
the excel specifications).


Or I was thinking As well, It might due to that my values are string (
and my xvalues are date), could it be pb ?


I already verified the length of each data, and they are the same for
Values and Xvalues.


The odd thing, is that my program does carry on after, and create the
following charts, but if you close excel or try to save the workbook ,
Excel crashes....
 
J

Jon Peltier

What kind of chart are you making?

If the values in the .Values property are text and not numeric, a line or XY
chart will choke. You could add your series as a column or area chart to
avoid this problem and convert the series to XY or Line after assigning all
the properties such as .Values and .XValues.

Also the limit on series in a workbook is 255, which is easy to remember if
you remember the limit of 256 columns in a worksheet, which in a simple
chart relates to one column for X and 255 for Y. (Excel 2007 has more
columns in a worksheet, but the same limitation on series in a chart). I
have rarely seen a chart with this many series that was at all easy to read.

- Jon
 
D

David

Thanks John , But apparently , My code worked even though there were
these strings as .values....(Bizarre isn't it?).
In fact , It was an error which had been kept (could it be?) within the
workbook on which I worked....
By that , I mean I created a new workbook , did exactly the same things
and it worked!!!
Could it be possible that Excel keeps in Memory ( within the workbook)
all the errors which have been made before?

Thanks John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top