I have a series of variables (each declared as a range) in a VBA script as follows:
r1 = range r2 = range ... r100 = range Ideally I'd like to use a for loop to select, copy, and paste (transpose) each range in succession. I'm writing my code via trial and error, and I have little familiarity with VBA. Currently I'm using a loop like the following:
For i = 0 To 99 Step 1 Dim Num As Integer Num = i + 1 Num = CStr(Num) Dim R As Range R = "r" & Num R.Select Selection.Copy Range("TARGET RANGE").Select Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=True Next i Can anyone help me debug this loop and/or find the best way to achieve this?