Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim col As Variant, P As Range, tablo, ub&, i&, dat, x$, j&
With Sheets("BASE")
col = Application.Match(Sh.Name, .Rows(3), 0)
If IsError(col) Then Exit Sub
On Error Resume Next: .ShowAllData: On Error GoTo 0
Set P = .Rows("3:" & .Range("A" & Rows.Count).End(xlUp).Row)
End With
Application.ScreenUpdating = False
P.Sort P(1), xlAscending, Header:=xlYes 'tri sur les dates
tablo = P.Resize(, col) 'matrice, plus rapide
ub = UBound(tablo)
Set P = Sh.Range("A3:E" & Sh.Range("A" & Sh.Rows.Count).End(xlUp).Row)
P.Sort P(1), xlAscending, Header:=xlYes 'tri sur les dates
For i = P.Rows.Count To 2 Step -1
dat = P(i, 1): x = P(i, 2) & P(i, 3) & P(i, 4)
For j = ub To 2 Step -1
If tablo(j, 1) < dat Then Exit For
If tablo(j, 1) = dat Then If x = tablo(j, 2) & tablo(j, 3) & tablo(j, col) Then GoTo 1
Next j
P.Rows(i).Delete xlUp 'suppression de la ligne non trouvée
1 Next i
End Sub