Bonjour le forum
J'utilise ce code pour une MFC,mais l'attente est très longue à chaque selection de cellule.
Y a t'il un moyen d'optimiser ce code pour gagner du temps.
Merci.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Cell As Range
For Each Cell In Range("A1:AA5000")
If Cell = "RP" Then
Cell.Interior.ColorIndex = 3
ElseIf Cell = "R/N" Then
Cell.Interior.ColorIndex = 28
ElseIf Cell = "M" Then
Cell.Interior.ColorIndex = 4
ElseIf Cell = "S" Then
Cell.Interior.ColorIndex = 6
ElseIf Cell = "RU" Then
Cell.Interior.ColorIndex = 3
ElseIf Cell = "N" Then
Cell.Interior.ColorIndex = 28
Else
Cell.Interior.ColorIndex = 15
End If
Next
End Sub