Copy rows and paste in a single column

Closed
saurabh - Oct 3, 2011 at 10:31 AM
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Oct 4, 2011 at 05:36 AM
Hello,

I have multiple data rows and columns in excel format

0.00111 0.00111 0.00111
0.000018 0.000018 0.000018
0.000017 0.000017 0.0000169

Data goes to about 18,000 rows and there are 10 data columns

I need to copy and paste as transpose as a single column as below

0.00111
0.00111
0.00111
0.000018
0.000018
0.000018
0.000017
0.000017
0.0000169

Please help..




1 response

venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 811
Oct 4, 2011 at 05:36 AM
try this macro

Sub test()
Dim j As Long
With Worksheets("sheet1")
 For j = 1 To .Range("A1").End(xlDown).Row
Range(.Cells(j, 1), .Cells(j, 1).End(xlToRight)).Copy
With Worksheets("sheet2")
.Cells(Rows.Count, "A").End(xlUp).Offset(1, 0).PasteSpecial , Transpose:=True
End With
Next j
End With
With Worksheets("sheet2")
.Range("A1").EntireColumn.AutoFit
End With
End Sub


Sub undo()
Worksheets("sheet2").Cells.Clear
End Sub
0