Option Explicit
Sub test()
Dim e, v, x, i As Long, dico As Object
Application.ScreenUpdating = False
Set dico = CreateObject("Scripting.Dictionary")
With Sheets("Feuil1").Range("a1").CurrentRegion
With .Offset(2).Resize(.Rows.Count - 2)
.Interior.ColorIndex = xlNone
'ici on associe une couleur a une categorie
For Each e In Array(Array("F", 41), Array("S", 42), Array("JF", 43), _
Array("JH", 44), Array("A1", 45), Array("A2", 46), _
Array("A3", 47), Array("A4", 48), Array("A5", 17), _
Array("V1", 50), Array("V2", 36), Array("V3", 37), _
Array("V4", 19), Array("V5", 20))
v = Evaluate("IF(" & .Columns(4).Address & "=""" & e(0) & """," & .Columns(7).Address & ")")
x = Application.Max(v)
dico(CStr(x)) = Empty
For i = 1 To UBound(v, 1)
If dico.exists(CStr(v(i, 1))) Then
.Rows(i).Interior.ColorIndex = e(1)
End If
Next
'dico.Remove CStr(x)
dico.RemoveAll
Next
End With
End With
Set dico = Nothing
Application.ScreenUpdating = True
End Sub