how do I let a macro repeat itself in excel

G

Guest

1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31 32 33 34 35
36 37 38 39 40 41 42

I want to have the figures above in 1 vertical column. I can do it by
Transpose them line by line, but is there a macro to automate this process

thanks
 
T

Tom Ogilvy

Sub AAA()
Dim i As Long, j As Long, k As Long
Dim v(1 To 42, 1 To 1)
k = 0
For j = 1 To 6
For i = 1 To 7
k = k + 1
v(k, 1) = Cells(j, i)
Next
Next
Range("I1").Resize(42, 1) = v

End Sub
 

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