Option Explicit
Sub Transpose()
Dim a, i As Long, j As Long, n As Long, txt As String, w
With Sheets("Feuil1").Range("A1").CurrentRegion
a = Application.Index(.Value, Evaluate("row(1:" & _
.Rows.Count & ")"), Array(1, 3, 4))
End With
With CreateObject("Scripting.Dictionary")
For i = 1 To UBound(a, 1)
txt = Join(Array(a(i, 1), a(i, 2)), Chr(2))
If Not .exists(txt) Then
n = n + 1: .Item(txt) = VBA.Array(n, 3)
For j = 1 To UBound(a, 2)
a(n, j) = a(i, j)
Next
Else
w = .Item(txt): w(1) = w(1) + 1
If UBound(a, 2) < w(1) Then
ReDim Preserve a(1 To UBound(a, 1), 1 To w(1))
End If
a(w(0), w(1)) = a(i, 3): .Item(txt) = w
End If
Next
End With
Application.ScreenUpdating = False
With Sheets.Add.Cells(1).Resize(n, UBound(a, 2))
.FormulaLocal = a
.Font.Name = "calibri"
.Font.Size = 10
.VerticalAlignment = xlCenter
.BorderAround Weight:=xlThin
.Borders(xlInsideVertical).Weight = xlThin
.Columns("a:b").Interior.ColorIndex = 44
.Columns.AutoFit
End With
Application.ScreenUpdating = True
End Sub