Hi Ospeng,
Manually create the header in sheet2, then run the following code:
Sub RunMe()
Dim iCol As Long
iCol = 2
Sheets("Sheet1").Select
Do
Sheets("Sheet2").Range("B" & Rows.Count).End(xlUp).Offset(1, 0) = Cells(1, iCol)
iCol = iCol + 1
Loop Until IsEmpty(Cells(1, iCol))
For Each cell In Range(Range("A2"), Range("A" & Rows.Count).End(xlUp))
Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1, 0) = cell
Sheets("Sheet2").Range("C" & Rows.Count).End(xlUp).Offset(1, 0) = cell.Offset(0, 2)
Sheets("Sheet2").Range("D" & Rows.Count).End(xlUp).Offset(1, 0) = cell.Offset(0, 1)
Next cell
End Sub
How to implement and run a code:
- From Excel hit Alt + F11 to open the "Microsoft Visual Basic" window.
- Go to the top menu in the newly opened window > Insert > Module.
- Paste the code in the big white field.
- You can now close this window.
- Back at Excel, hit Alt + F8 to display the available macro's.
- Double-click the macro you wish to run.
NOTE: macro's cannot be reversed using the blue arrows. Always make sure you save your file before running a code, so you can reopen your file if something unforeseen happens.
Best regards,
Trowa