Private Sub Worksheet_Change(ByVal Target As Range)
Dim tablo, d As Object, i&, ncol%, j%
'---liste des jours de garde---
tablo = [B7].CurrentRegion.Resize(, 2).Value2 'matrice des valeurs, plus rapide
Set d = CreateObject("Scripting.Dictionary")
For i = 2 To UBound(tablo)
If tablo(i, 2) <> "" Then d(CStr(tablo(i, 2))) = ""
Next i
'---traitement du 2ème tablo---
With [E7].CurrentRegion
ncol = .Columns.Count
If ncol = 1 Then ncol = 2 'au moins 2 cellules
tablo = .Resize(, ncol).Formula 'matrice des formules, plus rapide
For i = 2 To UBound(tablo)
If d.exists(tablo(i, 1)) Then
For j = 2 To ncol
tablo(i, j) = "XP"
Next j
End If
Next i
Application.ScreenUpdating = False
Application.EnableEvents = False
.Replace "XP", "", xlWhole 'RAZ
.Formula = tablo 'restitution
Application.EnableEvents = True
End With
End Sub