Private Sub CommandButton2_Click() 'job75
Dim P As Range, col%, c As Range, n&, r As Range
Application.ScreenUpdating = False
Set P = [A2].CurrentRegion
col = P.Columns.Count + 2 'colonne G
P.Columns(col).ClearContents 'RAZ
For Each c In Range("P2", Range("P" & Rows.Count).End(xlUp))
n = 0
For Each r In P.Rows
If Application.CountIf(r, c) Then
If Application.CountIf(r, c(, 2)) Then
r.Cells(, col) = r.Cells(, col) + 1
n = n + 1
End If
End If
Next
c(, 0) = n
Next
[O:Q].Sort [O1], xlDescending, Header:=xlYes 'tri sur colonne O
P.Resize(, col).Sort P(, col), xlDescending, Header:=xlNo 'tri sur colonne G
End Sub