Chart series

G

Guest

I have a macro that assign new values to different chart. I have gotten this
to work but I keeps giving me problems from time to time, sometimes it works
sometimes it does not. My code for assigning the y-series is:

Do While k < (UBound(rng) + 1)
If Not IsEmpty(rng(k)) Then
ActiveChart.SeriesCollection(k - 1).Values =
Sheets(varWorksheetInfoArray(0)).Range(rng(k).Offset(i, 0).Address & ":" &
rng(k).Offset(j, 0).Address)
Else: End If
k = k + 1
Loop

Is there something wrong with this code? It works for some series sometimes.
Is there anything you should do with the charts before assigning new values?
It really bugs me that it keeps giving me trouble and I think the code is
right (it gives the correct range to the correct series but sometimes it does
not change the range). If anyone has done anything like this before please
help me!! I am really desperate on this because I cannot figure it out! Any
assistance is appreciated!! Thank you!
 
D

Die_Another_Day

I've had trouble when the Worksheet sometimes has spaces and sometimes
doesn't. Do you know whether or not your series contains spaces?

HTH

Die_Another_Day
 

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

Similar Threads

Checking contents of arrays 1
Series 3
Data series 1
Code does not error but no copy either 4
Inaccurate count with code 6
Trouble creating a chart 2
VB script line graph 1
FOR loop macro 5

Top