See the attached file.
I used the macro below to get the result.
Sub CONVERTROWSTOCOL_Oeldere_revisted()
Dim rsht1 As Long, rsht2 As Long, i As Long, col As Long, wsTest As Worksheet
'check if sheet "ouput" already exist
Const strSheetName As String = "Output"
Set wsTest = Nothing
On Error Resume Next
Set wsTest = ActiveWorkbook.Worksheets(strSheetName)
On Error GoTo 0
If wsTest Is Nothing Then
Worksheets.Add.Name = strSheetName
End If
With Sheets("Output")
.UsedRange.ClearContents
.Range("A1:D1").Value = Array("Work", "Choise", "Name", "value")
End With
rsht1 = Sheets("sheet2").Range("A" & Rows.Count).End(xlUp).Row
rsht2 = Sheets("Output").Range("A" & Rows.Count).End(xlUp).Row
col = 3
For i = 4 To rsht1
Do While Sheets("sheet2").Cells(3, col).Value <> ""
rsht2 = rsht2 + 1
Sheets("Output").Range("A" & rsht2).Value = Sheets("sheet2").Range("A" & i).Value
Sheets("Output").Range("B" & rsht2).Value = Sheets("sheet2").Range("B" & i).Value
Sheets("Output").Range("C" & rsht2).Value = Sheets("sheet2").Cells(3, col).Value
Sheets("Output").Range("D" & rsht2).Value = Sheets("sheet2").Cells(i, col).Value
col = col + 1
Loop
col = 3
Next
With Sheets("Output")
' .Range("D2:D" & .Rows.Count).SpecialCells(4).EntireRow.Delete
Columns("A:Z").EntireColumn.AutoFit
End With
End Sub
Bookmarks