Sub MigrateData()
Dim m As Integer
Dim r As Integer
Dim mR As Long
Dim eR() As String
Dim n As Long
Dim i As Long
Dim x As Long
Worksheets(3).Range("A:M").ClearContents
With Worksheets(2)
mR = .Cells(Sheets("Sheet2").Rows.Count, 1).End(xlUp).row - 1
End With
For m = 1 To 12
With Worksheets(3)
.Cells(1, 1) = "Line"
.Cells(1, 2 + m - 1) = m
.Cells(1, 2 + m - 1).HorizontalAlignment = xlCenter
.Cells(1, 2 + m - 1).Font.Bold = True
End With
n = 1
For r = 1 To mR
If Worksheets(2).Cells(r + 1, 2) = m Then
n = n + 1
Worksheets(3).Cells(n, 1) = Worksheets(2).Cells(r + 1, 1)
With Worksheets(3)
.Cells(n, m + 1) = Worksheets(2).Cells(r + 1, 3)
End With
End If
Next
Next
Worksheets(3).Activate
End Sub