Set r = [D:D,J:J,P:P,V:V,AB:AB]
r.Interior.ColorIndex = xlNone 'RAZ
For Each r In Intersect(r, UsedRange.EntireRow)
x = CStr(r)
If d.exists(x) Then r.Interior.Color = d(x)
Next
Sub TEST()
Application.ScreenUpdating = False
With Sheets("Feuil2")
.Range("D2:D30").Interior.Color = RGB(255, 255, 255)
End With
For Each xCell In Range("C2:C30")
xEquiv = Application.Match(xCell.Value, Sheets("Feuil2").Range("D2:D30"), 0)
If IsError(xEquiv) = False Then
If xCell.Interior.Color = RGB(0, 176, 80) Then
With Sheets("Feuil2")
.Range("D" & xEquiv + 1).Interior.Color = RGB(0, 176, 80)
End With
End If
End If
Next xCell
Application.ScreenUpdating = True
MsgBox "Mise à jour terminée", vbInformation, "MAJ"
End Sub
Private Sub Worksheet_Activate()
Dim d As Object, c As Range, x$
Set d = CreateObject("Scripting.Dictionary")
d.CompareMode = vbTextCompare 'la casse est ignorée
With Feuil1 'CodeName de la feuille
If .FilterMode Then .ShowAllData 'si la feuille est filtrée
For Each c In .Range("C1", .Range("C" & .Rows.Count).End(xlUp))
x = CStr(c)
If x <> "" Then d(x) = c.Interior.Color 'mémorise la couleur
Next
End With
Application.ScreenUpdating = False
If FilterMode Then ShowAllData 'si la feuille est filtrée
[D:D].Interior.ColorIndex = xlNone 'RAZ
For Each c In Range("D1", Range("D" & Rows.Count).End(xlUp))
x = CStr(c)
If d.exists(x) Then c.Interior.Color = d(x)
Next
End Sub
Set r = [D:D,J:J,P:P,V:V,AB:AB]
r.Interior.ColorIndex = xlNone 'RAZ
For Each r In Intersect(r, UsedRange.EntireRow)
x = CStr(r)
If d.exists(x) Then r.Interior.Color = d(x)
Next