Private Sub CommandButton1_Click()
Dim T, i As Long, dico, Clé, OK As Boolean, T2
Set dico = CreateObject("Scripting.Dictionary")
With Worksheets("Exemple") '** => à adapter
T = .Range("E18:P" & .Range("E" & Rows.Count).End(xlUp).Row)
For i = LBound(T, 1) To UBound(T, 1)
For j = LBound(T, 2) To UBound(T, 2)
dico(T(i, j)) = dico(T(i, j)) + 1
Next
Next
T2 = Application.Transpose(Array(dico.keys, dico.Items))
'**** tri en ordre décroissant
While OK = False
OK = True
For i = LBound(T2, 1) To UBound(T2, 1) - 1
If T2(i, 2) < T2(i + 1, 2) Then
Tmp1 = T2(i, 1)
Tmp2 = T2(i, 2)
T2(i, 1) = T2(i + 1, 1)
T2(i, 2) = T2(i + 1, 2)
T2(i + 1, 1) = Tmp1
T2(i + 1, 2) = Tmp2
OK = False
End If
Next
Wend
'** copie des 12 nombres (sur 24)étant le plus souvent sortis
.Range("E5").Resize(1, 12) = Application.Transpose(T2)
End With
End Sub