Sub FiltrerCouleurs(filtre As Boolean)
If filtre Then
Dim decharge%, plage As Range, d As Object, cel As Range, fci As Variant, i%, f As Range, n%
decharge = 100
Set plage = Intersect(ActiveSheet.UsedRange, Range("A2:C" & Rows.Count)) 'colonnes A:C
If plage Is Nothing Then Exit Sub 'sécurité
'---mémorisation des couleurs---
Set d = CreateObject("Scripting.Dictionary")
For Each cel In [K1].CurrentRegion.Resize(, 1) 'à adapter
d(cel.Font.ColorIndex) = ""
Next cel
'---masquage---
Application.ScreenUpdating = False
plage.EntireRow.Hidden = True
For Each cel In plage
If cel <> "" Then
fci = cel.Font.ColorIndex
If IsNull(fci) Then 'si coloration partielle
For i = 1 To Len(cel)
If d.exists(cel.Characters(i, 1).Font.ColorIndex) Then GoTo 1
Next i
ElseIf d.exists(fci) Then
1 Set f = Union(IIf(n, f, cel), cel)
n = n + 1
End If
If n = decharge Then f.EntireRow.Hidden = False: n = 0: Set f = Nothing
End If
Next cel
If n Then f.EntireRow.Hidden = False
Else
Rows.Hidden = False
End If
End Sub