Series
Viktor,
I have found that an easy way to get new data into a chart reliably is to create the chart with a
known range, and then use a macro to delete the values in that range and write the new, desired
values into the range. Then you never need to change the seriescollection property....
HTH,
Bernie
MS Excel MVP
"Viktor Ygdorff" wrote in message
...
My macro reads inputs from the user, uses this input to search a spreadsheet
for existing info and then update charts with the info from the spreadsheet.
It all works fine. My problem is that when updating the charts it is not
enough to simply write:
ActiveChart.SeriesCollection(varWorksheetInfoArray (k)).Values =
Sheets(varWorksheetInfoArray(0)).Range(rng(k).Offs et(i, 0).Address & ":" &
rng(k).Offset(j, 0).Address)
(do not care about the variables etc.) That is declareing the range for a
series does not automatically mean that you get that series. If e.g. the
chart already has a series and the x-axis and the y-series are not equally
long Excel presses data together so that giving new ranges to both x-axis and
y-series does not imply that these are the series that you actually get. Now
this causes some major problems for since I must let the user modify the
charts in order to e.g. evaluate different scenarios. However once the user
has done that my program is busted since the series that my program sets will
not necessarily be displayed in the chart. Is there any way of solving this?
I have tried with deleting existing series and then adding new ones again but
that gave me some headache also.. Thus if anyone has any clue about this
please help me out! Thank you very much. I am grateful for any help that I
get.
Ygdorff
|