Hi laskuh,
Try this macro and see if it does what you want for one of your data
files. It should transfer your data as described, starting in cell A2 -
Sub MoveDataToColumn()
Dim icol As Integer
Dim lrow As Long
Dim rngCopy As Range
Dim rngPaste As Range
Application.ScreenUpdating = False
icol = 2
Columns(1).Insert Shift:=xlToRight
For lrow = 1 To Cells(Rows.Count, icol).End(xlUp).Row
Set rngCopy = Range(Cells(lrow, icol), _
Cells(lrow, icol).End(xlToRight))
Set rngPaste = Cells(Rows.Count, icol - 1).End(xlUp).Offset(1, 0)
' if the next data record will fill oe exceed the column rows
If rngPaste.Row + rngCopy.Cells.Count = Rows.Count Then
' insert a new column and start at row 2 again
Columns(icol).Insert Shift:=xlToRight
icol = icol + 1
Set rngPaste = Cells(Rows.Count, icol - 1).End(xlUp).Offset(1, 0)
End If
rngCopy.Copy
rngPaste.PasteSpecial Transpose:=True
rngCopy.ClearContents
Next lrow
Application.CutCopyMode = False
Cells(1, 1).Select
End Sub
Regards,
Gary
|