Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim r As Range
If Not IsDate(Sh.Name) Then Exit Sub
'---colonne A---
Set r = Intersect(Target, Sh.Range("A10:A" & Sh.Rows.Count), Sh.UsedRange)
If Not r Is Nothing Then
Application.ScreenUpdating = False
For Each r In r 'si entrées/effacements multiples
r(1, 34).Resize(, [Codes].Count) = IIf(IsEmpty(r), "", "=COUNTIF(RC2:RC32,R9C)")
If IsEmpty(r) Then r(1, 2).Resize(, 31) = ""
Next
Sh.Range("A10:AT" & Sh.Rows.Count).Sort Sh.[A10], Header:=xlNo 'tri sur les noms
End If
'---colonnes B:AF---
Set Target = Intersect(Target, Sh.Range("B10:AF" & Sh.Rows.Count), Sh.UsedRange)
If Not Target Is Nothing Then
Application.ScreenUpdating = False
On Error Resume Next
For Each Target In Target 'si entrées/effacements multiples
Set r = [Codes].Find(Target, , xlValues, xlWhole)
If r Is Nothing Or Weekday(Target(9 - Target.Row)) = 1 Then
If Target <> "" Then Target = ""
Target.Interior.ColorIndex = xlNone 'RAZ
Target.Font.ColorIndex = 2 'RAZ (police blanche sur B10:AF1048576)
Else
Target.Interior.Color = r.Interior.Color
Target.Font.Color = r.Font.Color
End If
Next
End If
End Sub