Try this code
Option Explicit
Sub transpose_data()
Dim i As Long, lrow As Long, lcol As Long
Dim sname As String
With Worksheets(1)
lrow = .Range("A" & .Rows.Count).End(xlUp).Row
For i = 1 To lrow
sname = .Range("A" & i + 1).Value
If Not Evaluate("ISREF('" & sname & "'!A1)") Then
Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = sname
End If
.Range("A" & i & ":BLQ" & i).Copy
lcol = Worksheets(sname).Range("IV2").End(xlToLeft).Column
Worksheets(sname).Cells(2, lcol + 1).PasteSpecial , Paste:=xlPasteValues, Transpose:=True
.Range("A" & i + 1 & ":BLQ" & i + 1).Copy
lcol = Worksheets(sname).Range("IV2").End(xlToLeft).Column
Worksheets(sname).Cells(2, lcol + 1).PasteSpecial , Paste:=xlPasteValues, Transpose:=True
i = i + 1
Next i
End With
For i = 2 To Worksheets.Count
With Worksheets(i)
.Columns(1).Delete
lrow = .Range("A" & .Rows.Count).End(xlUp).Row
.Range("E2:E" & lrow).FormulaR1C1 = "=IF(RC[-3]=RC[-1],""Pass"",""Fail"")"
End With
Next i
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