Macro to Transpose 1 col into 3 cols
Range(Cells(i, 2), Cells(i, 3)).Select
should be
Range(Cells(i, 2), Cells(i, 4)).Select
or just use
Cells(i,2)
However, I would do something like
Sub TransposeData()
Dim i as Long, j as Long
j = 1
for i = 1 to 3004 step 3
cells(i,1).Resize(3,1).copy
cells(j,2).PasteSpecial xlAll, Transpose:=True
j = j + 1
Next
Columns(1).ClearContents
end sub
--
Regards,
Tom Ogilvy
" wrote:
I am trying to transpose 1 column into 3 columns:
Example:
1
2
3
4
5
6
7
8
9
ect...
into
123
456
789
ect...
Here is the code I have:
-----------------------
Dim i As Long
i = 1
Do While i < 3001
Range("A1:A3").Select
Application.CutCopyMode = False
Selection.Copy
Range(Cells(i, 2), Cells(i, 3)).Select
problem here--Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone,
SkipBlanks_:=False
, Transpose:=True
Range("A1").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp
i = i + 1
Loop
---------------------------------------
It keeps hanging up he
Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone,
SkipBlanks_:=False
, Transpose:=True
I have no clue as why it is hanging...any help?
Thanks,
James
|