Sub Classer()
Dim d As Object, lig&, i&, crit$
Set d = CreateObject("Scripting.Dictionary")
d.CompareMode = vbTextCompare 'la casse est ignorée
Application.ScreenUpdating = False
[H:N].Clear 'RAZ
With [A1].CurrentRegion
.Columns(6).NumberFormat = "0.0"
.Columns(6).Replace ".", ".", xlPart 'convertit la colonne
.Sort .Columns(3), xlAscending, .Columns(4), , xlAscending, .Columns(6), xlDescending, Header:=xlYes 'tri sur 3 colonnes
.Columns(5).Insert xlToRight 'colonne auxiliaire
.Columns(5) = "=RC[-2]&RC[-1]"
.Columns(5) = .Columns(5).Value 'supprime les formules
lig = 1
For i = 2 To .Rows.Count
crit = .Cells(i, 3) & .Cells(i, 4)
If .Cells(i, 3) <> "" And Not d.exists(crit) Then
d(crit) = ""
.AutoFilter 5, crit 'filtre automatique
.Copy .Cells(lig, 10) 'copier-coller
.AutoFilter 'ôte le filtre
.Cells(lig, 10).Resize(, 7).Clear 'supprime les titres
.Cells(lig + 1, 10).CurrentRegion.Resize(, 7).Offset(3).Clear 'ne garde que 3 lignes
.Cells(lig + 1, 9) = 1
If .Cells(lig + 2, 10) <> "" Then .Cells(lig + 2, 9) = 2
If .Cells(lig + 3, 10) <> "" Then .Cells(lig + 3, 9) = 3
lig = lig + Application.Max(.Cells(lig + 1, 9).Resize(3)) + 1
End If
Next
.Columns(14).Delete xlToLeft
.Columns(5).Delete xlToLeft 'supprime la colonne auxiliaire
End With
End Sub