rearranging the data

  • Thread starter Data Rearranging
  • Start date
D

Data Rearranging

I have the data with 3000 rows and each row contains 24 values
the format of data is as given
row1 a1 a2 a3,......,a23,a24
row2 b1 b2 b3,.......b23, b24

..
..
..
row3000
i want to rearrange all data in single column as follows
a1
a2
a3
..
..
..
..
a24
b1
b2
b3
..
..
..
b24
 
F

filo666

select the data and run:

Sub Transpose()
Dim cnt1 As Integer
Dim arr1() As Variant
cnt1 = 0
For Each cl In Selection.Cells
cnt1 = cnt1 + 1
ReDim Preserve arr1(cnt1)
arr1(cnt1) = cl
Next cl
Selection.ClearContents
For cnt1 = 1 To UBound(arr1)
Cells(cnt1, 1) = arr1(cnt1)
Next
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