Option Explicit
Sub test()
Dim a, i As Long, j As Long, n As Long
Application.ScreenUpdating = False
With Sheets("Feuil1").Range("a1").CurrentRegion.Columns("a:b")
a = .Value: n = 1
With CreateObject("Scripting.Dictionary")
.CompareMode = 1
For i = 2 To UBound(a, 1)
If Not .exists(a(i, 1)) Then
n = n + 1
.Item(a(i, 1)) = n
For j = 1 To UBound(a, 2)
a(n, j) = a(i, j)
Next
Else
'a(.Item(a(i, 1)), 2) = Application.Max(a(.Item(a(i, 1)), 2), a(i, 2))
If a(.Item(a(i, 1)), 2) < a(i, 2) Then
a(.Item(a(i, 1)), 2) = a(i, 2)
End If
End If
Next
End With
With .Offset(, .Columns.Count + 2)
.CurrentRegion.Clear
.Cells(1).Resize(n, UBound(a, 2)).Value = a
With .CurrentRegion
.Font.Name = "calibri"
.Font.Size = 10
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Borders(xlInsideVertical).Weight = xlThin
.BorderAround Weight:=xlThin
With .Rows(1)
.Font.Size = 11
.Interior.ColorIndex = 38
.BorderAround Weight:=xlThin
End With
.Columns.AutoFit
End With
End With
End With
Application.ScreenUpdating = True
End Sub