Using variables (maybe?) to go through rows.


Posted by Chris Whisonant on September 11, 2000 6:39 PM

Ok, here is my macro:

Range("D1:D23").Select
Selection.Copy
Range("G1").Select
Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone, SkipBlanks:=False _
, Transpose:=True
End Sub

What I need to do is have the row number as a variable (or other solution you could help with). The "D" column represents the hours in a day (1-23) and I have over 18,000 rows to analyze! A While loop or something to that effect seemed the probability and I would start with

X = 1
While X < 19000
Range("D(X):D(X+22)").Select
Selection.Copy
Range("G(X)").Select
Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone, SkipBlanks:=False _
, Transpose:=True
X = X + 23
Wend
End Sub

This, of course, does not work. I am hoping that this has been enough information for someone to see what I'm at least trying to go for.

Any help is greatly appreciated,
Chris

Posted by Chris Whisonant on September 12, 0100 5:08 AM

Thanks Ivan, that did the trick!!



Posted by Ivan Moala on September 11, 0100 9:30 PM


Chris try

x = 1
While x < 19000
Range("D" & x & ":D" & (x + 22)).Select
Selection.Copy
Range("G" & x).Select
Selection.PasteSpecial Transpose:=True
x = x + 23
Wend

Ivan