Move x cells in rows to single column

moose2210

New Member
Joined
Jun 13, 2011
Messages
4
hi all

I have this table an i need to convert it to two column

header 1 data1 data2 data3 data4 data5 data6
header 2 fra1 fra2 fra3 fra4 fra5 fra6 fra7
header 3 gres1 gres2 gres3 gres4 gres5

convert to

header 1 data1
header 1 data2
header 1 data3
etc

thanks
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Assuming header1 is in A1 and data1 is in cell B1, data2 is in cell C1 etc, try:
Code:
Sub MoveMe()
 
Dim i As Long, j As Long
 
With Application
    .ScreenUpdating = False
    .Calculation = xlCalculationManual
End With
 
With Columns("A:A")
    .Insert shift:=xlToRight
    .Insert shift:=xlToRight
End With

k = 1
For i = 1 To Cells(Rows.Count, 3).End(xlUp).Row
    j = 4
    Do While Not IsEmpty(Cells(i, j))
        Range("A" & k) = Cells(i, 3)
        Range("B" & k) = Cells(i, j)
        Cells(i, j).ClearContents
        j = j + 1
        k = k + 1
    Loop
    Cells(i, 3).ClearContents
Next i
 
With Application
    .ScreenUpdating = True
    .Calculation = xlCalculationAutomatic
End With
 
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,583
Messages
6,179,678
Members
452,937
Latest member
Bhg1984

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