Transpose of Rows into 25 columns

waqar1239

New Member
Joined
Mar 26, 2017
Messages
27
Hello Team,

I am having new challenege in the excel. I have a 9000 rows in one column and i want to split the rows into 6 columns.Means first 6 rows convert into 6 colums and then next 6 rows become the net row of the new data example shown below.
Main Data

Output Data File




I apprceif someonecan help me.

Cheers
 
Last edited by a moderator:

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
I think this will do what you are looking for. This code assumes that your data is in column A, and the results are being output to columns F:K. You can adjust those lines of code as needed.

Code:
Sub Xpose()
Dim AR() As Variant: AR = Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row).Value
Dim AL As Object: Set AL = CreateObject("System.Collections.ArrayList")
Dim tmp As String

For i = LBound(AR) To UBound(AR)
    tmp = tmp & AR(i, 1) & ","
    If i Mod 6 = 0 Then AL.Add tmp: tmp = vbNullString
Next i

With Range("F1").Resize(AL.Count, 1)
    .Value = Application.Transpose(AL.toArray)
    .TextToColumns DataType:=xlDelimited, comma:=True
End With

End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,758
Messages
6,126,713
Members
449,332
Latest member
nokoloina

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top