Const Feuille = "Feuil1" 'feuilles des données
Const debut = "B6" 'première cellule des données (yc en-tête)
Sub Commenter()
Dim derlig&, t, i&, clef, s$, r$, comm$, n&
Application.ScreenUpdating = False
Sheets(Feuille).Activate
If ActiveSheet.FilterMode Then ActiveSheet.ShowAllData
derlig = Range(debut).Offset(, 1).End(xlDown).Row
t = Range(Range(debut).Offset(1), Cells(derlig, Range(debut).Column + 5))
Set dico = CreateObject("scripting.dictionary")
dico.CompareMode = TextCompare
For i = 1 To UBound(t): dico(t(i, 2)) = dico(t(i, 2)) & ";" & t(i, 6): Next
For Each clef In dico
s = dico(clef) & ";": dico(clef) = "": r = ""
Do While s <> ""
Do While Left(s, 1) = ";": s = Mid(s, 2): Loop
If s = "" Then Exit Do
comm = Split(s, ";")(0) & ";"
If comm = "" Then Exit Do
n = Len(s): s = Replace(s, comm, ""): n = (n - Len(s)) / Len(comm)
If n > 0 Then r = r & n & " " & Left(comm, Len(comm) - 1)
If n > 1 Then r = r & "S"
r = Replace(r & " - ", "TOTALS", "TOTAL")
dico(clef) = r
Loop
Next clef
For i = 1 To UBound(t): t(i, 6) = dico(t(i, 2)): Next
For i = 1 To UBound(t)
If Len(t(i, 6)) <> 0 Then t(i, 6) = Left(t(i, 6), Len(t(i, 6)) - 3)
Next i
Range(Cells(Range(debut).Row + 1, Range(debut).Column + 10), Cells(derlig, Range(debut).Column + 10)) = Application.Index(t, 0, 6)
End Sub