Changing chart data ranges from VBA code

A

Andrew

Hello,
I have a VBA program which will be generating a lot of data, and I
want to be able to view the data on a chart. The chart only holds
32000 samples, and my program is likely to generate 100,000 samples.
So, I start out with the source data range being fixed at R1C2 to
R32001C2. But when I get to a count of 31000 samples, I want the data
range to shift up by 1000 rows, so that the new data range would be
R1001C2 to R33000C2. And I want this process to repeat for every 1000
samples. Can someone please send me a snippet of code to perform this
task.

Here is my starting code.

Dim datacount as double
If datacount > 31000 And datacount Mod 1000 = 0 Then

With Worksheets("monitor").ChartObjects(1).Chart
.SeriesCollection(1).XValues = "=data!R1C2:R32000C2"
.SeriesCollection(1).Values = "=data!R1C4:R32000C4"
End with
End If


thanks,
Andy
 
A

Andrew

for i=1 to 60000 step 1000
do it
next i

I apologize for poorly describing my question. I know how to create
the loop to find the multiples of 1000. What I don't know is how to
enter "=data!R1C2:R32000C2" in the form of a variable.
 

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