Try this code
Option Explicit
Sub transpose()
Dim ws As Worksheet
Dim i As Long, lrow As Long, lcol As Long, j As Long, lastrow As Long
Application.ScreenUpdating = False
Set ws = Worksheets("Sheet2")
ws.Range("A1:C1").Value = Split("Personal ID, Class, Date", ",")
With Worksheets("Sheet1")
lrow = .Range("A" & .Rows.Count).End(xlUp).Row
For i = 2 To lrow
lcol = .Range("IV" & i).End(xlToLeft).Column
For j = 2 To lcol
lastrow = ws.Range("A" & Rows.Count).End(xlUp).Row
ws.Range("A" & lastrow + 1).Value = .Cells(i, 1).Value
ws.Range("B" & lastrow + 1).Value = .Cells(i, j).Value
ws.Range("C" & lastrow + 1).Value = .Cells(1, j).Value
Next j
Next i
End With
MsgBox "Done"
Application.ScreenUpdating = True
End Sub
Copy the Excel VBA code
Select the workbook in which you want to store the Excel VBA code
Hold the Alt key, and press the F11 key, to open the Visual Basic Editor
Choose Insert | Module
Where the cursor is flashing, choose Edit | Paste
To run the Excel VBA code:
Choose Tools | Macro | Macros
Select a macro in the list, and click the Run button
Bookmarks