katieexcel
New Member
- Joined
- Feb 20, 2013
- Messages
- 4
Hii, I need help with some code... I am stuck and have a feeling I'm nowhere near solving this myself! 
I have 24 sets of data in columns 3-26.
Data is in rows 2-n (all datasets are same length). 'n' is typically around 2000.
I am plotting 24 series on one chart. With about 2000 data points it's hard to make any sense of each series, so I want to use fewer data points.
I want to plot every 20th data point. Then I will have 100 points for each of my 24 series.
[Eventually, I might want to take an average of every 20 datapoints and plot 100 mean values (x 24) but I can't face that right now!]
This is code I have come up with....
This code is plotting the 24th series, which is in column 26. I don't understand why it is plottin the 24th series when it says range "c2"? Surely it should plot the first series, which is in that column?
I am not sure how to make this for for all i, I tried
but it didn't work. Even if it did work, how do I write
correctly?
THANKSSSSSS, I'm so bad at this ! x

I have 24 sets of data in columns 3-26.
Data is in rows 2-n (all datasets are same length). 'n' is typically around 2000.
I am plotting 24 series on one chart. With about 2000 data points it's hard to make any sense of each series, so I want to use fewer data points.
I want to plot every 20th data point. Then I will have 100 points for each of my 24 series.
[Eventually, I might want to take an average of every 20 datapoints and plot 100 mean values (x 24) but I can't face that right now!]
This is code I have come up with....
Code:
With Worksheets(var)
Set rrange = .Range("C2", .Cells(.Rows.Count, "c").End(xlUp))
End With
For i = 1 To 24
For r = 1 To rrange.Rows.Count Step 20
If r = 1
Then
Set yvals = rrange(r, i)
Else
Set yvals = Union(rrange(r, i), yvals)
End If
Next r
Next i
This code is plotting the 24th series, which is in column 26. I don't understand why it is plottin the 24th series when it says range "c2"? Surely it should plot the first series, which is in that column?
I am not sure how to make this for for all i, I tried
Code:
Set vals(i)=range(r,(i))
Code:
Set rrange = .Range("&i&2", .Cells(.Rows.Count, "&i&").End(xlUp))
THANKSSSSSS, I'm so bad at this ! x