Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating and updating charts in excel 97--Urgent

Status
Not open for further replies.

qureshi

Programmer
Mar 17, 2002
104
AU
Hi,
I have created a program which picks up data from an excel sheet and creates charts for that data.

All seems to be fine except that only one series is not being updated.

Sample code being used is as under:

Dim datarange1 as range
Dim datarange2 as range
Dim datarange3 as range
Dim datarange4 as range
Dim datarange5 as range
.
.
set datarange1= ActiveSheet.Range("A" & Starting & ":A" & Ending)
set datarange2= ActiveSheet.Range("C" & Starting & ":C" & Ending)
.
.
set datarange5= ActiveSheet.Range("D" & Starting & ":D" & Ending)

.
.
ActiveChart.seriescollection(1).XValues = datarange1
ActiveChart.seriescollection(2).Values = datarange2
ActiveChart.seriescollection(3).Values = datarange3
ActiveChart.seriescollection(4).Values = datarange4
ActiveChart.seriescollection(5).Values = datarange5

Problem: All except one of the seriescollection is not updated.i.e. seriescollection(4).

I am confused because all the series are using the same instructions so why is this one series not being updated.

Please help. I have been on this for over two weeks.

Thanks

 
Oddly, you did not show us the definition of range 4.
Try changing the lines datarange4 = and datarange3= around just by changing the digit on each row.
If range3 is then the one that vanishes, it is your range definition for range 4
 
Thanks for the reply. I figured out the problem. For those who want to know, the problem was with the seriescollection. The change made was:

ActiveChart.seriescollection(4).Values = datarange4

This had to be changed to:

ActiveChart.seriescollection(1).Values = datarange4

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top