Setting Axis scale

  • Thread starter Thread starter Robin Clay
  • Start date Start date
R

Robin Clay

Greetings !

When I address a different data file, I have code to
generate a chart to display the new data.

For some s t r a n g e reason, the code SOMETIMES comes
to a grinding halt at this line -

.SeriesCollection(4).XValues = _
"=Ali2!R" & VTPStartRow & _
"C2:R" & VTPEndRow & "C2"

VTPStartRow has a value of say 80, and VTPEndRow about
100, and it works just FINE if I enter them "manually".

It never stops anywhere else, always at this line ! But
sometimes it works OK....
 
Robin -

Before you get to this line, is the series formula valid? If the series
has no plottable data (all blanks or error values, for instance), you
will not be able to access or edit the series formula or its constituent
parts (like the XValues).

Rumor has it, and I have not extensively tried this workaround, that
changing the series to an area type will enable you to access the series
formula in such a case. Then when the series is appropriately
populated, you can revert to your original chart type.

- Jon
 
Oh, absolutely ! It starts off with a previous (working)
value, then calculates a new one, and then tries
to "insert" it into the Chart.

It grinds to a halt, and the values are there in
the "Locals" window, and I can then use these to insert
the figures manually, whereupon it works OK.

However.... it frequently just keels over at that point !
The Chart appears with a hatched box round it, and then
Bingo ! Excel crashes....

But it is ALWAYS at that particular line ! It works FINE
for the other Series...

Sounds like a classic crash, all right.

I made your code work fine in a dummy worksheet. I wonder whether your
own workbook may be getting corrupt. Can you build a new workbook that
has your data and chart, then test it again?
You've lost me ... :(

This is what I meant:

With ActiveChart.SeriesCollection(1)
myType = .ChartType
.ChartType = xlArea
.Values = _
"=Ali2!R" & VTPStartRow & _
"C2:R" & VTPEndRow & "C2"
.ChartType = myType
End With

Can't promise anything, and since your series formula is valid before
this happens, it probably won't help.

- Jon
 
Back
Top