I have experience with C/C++ but I am new to VBA
and Excel
.
What I have is:
Range("A7:L7").Select
Selection.Copy
Range("R18").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
'One column copied
The problem is that I want to go through an entire range of cells (everything from A6:L6
all the way up to A41:41
).
I tried looking into For loops but I don't understand exactly how indexing works when selecting ranges. Here's what I have written so far:
pasteLocation = 6
For i = 6 To 41
Range("A" & i:"L" & i).Select
Selection.Copy
Range("R" & pasteLocation).Select '+12 every time to this counter
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
pasteLocation = pasteLocation + 12 'want to move down by 12 every time
Next i
Clearly I'm doing something wrong because I get "Compile Error: Expected: list separator or )"
Can anyone explain how indexing with VBA
works and what I'm doing wrong?