Re : Aide pour un problème de fréquence !!!!! (urgent)
Bonjour
Premièrement le mot urgent est à banir
Généralement quand on le voit, on ne lit pas la demande
Je fais exception:
voici la macro
Sub dudule()
Dim tableau 'Crée une variable
Set tableau = CreateObject("Scripting.Dictionary")
Dim resultat(5, 2)
Feuil1.Select
ligne = 6
col = 8
While Cells(ligne, col) <> ""
Cells(ligne, col).Select
cle = "C" & Cells(ligne, col)
If IsEmpty(tableau(cle)) Then
tableau(cle) = 1
nb = nb + 1
Else
tableau(cle) = tableau(cle) + 1
End If
For b = 1 To 5
If tableau(cle) > resultat(b, 1) Then
For b1 = 5 To b Step -1
resultat(b1, 1) = resultat(b1 - 1, 1)
resultat(b1, 2) = resultat(b1 - 1, 2)
Next
resultat(1, 1) = tableau(cle)
resultat(1, 2) = cle
Exit For
End If
Next
ligne = ligne + 1
Wend
Feuil2.Select
Cells(5, 3) = Mid(resultat(1, 2), 2)
Cells(5, 4) = resultat(1, 1)
Cells(6, 3) = Mid(resultat(2, 2), 2)
Cells(6, 4) = resultat(2, 1)
Cells(7, 3) = Mid(resultat(3, 2), 2)
Cells(7, 4) = resultat(3, 1)
Cells(8, 3) = Mid(resultat(4, 2), 2)
Cells(8, 4) = resultat(4, 1)
Cells(9, 3) = Mid(resultat(5, 2), 2)
Cells(9, 4) = resultat(5, 1)
End Sub