Private Sub Worksheet_Change(ByVal Target As Range)
Dim lig&, t1, t2, t3, t4, t5, x$, P As Range, tablo, i&
Set Target = Intersect(Target, Me.UsedRange)
If Target Is Nothing Then Exit Sub
For Each Target In Target 'en cas d'entrées multiples
lig = Target.Row
If lig > 3 Then
t1 = Cells(lig, 1): t2 = Cells(lig, 2)
t3 = Cells(lig, 3): t4 = Cells(lig, 4): t5 = Cells(lig, 5)
If t1 <> "" And t2 <> "" And t3 <> "" Then
If t4 <> "" Then
x = t1 & t2 & t3 & t4
With Sheets("1")
Set P = .Range("A3:D" & .Range("A" & .Rows.Count).End(xlUp).Row)
End With
tablo = P 'matrice, plus rapide
For i = 1 To UBound(tablo)
If x = tablo(i, 1) & tablo(i, 2) & tablo(i, 3) & tablo(i, 4) Then GoTo 1
Next
P(i, 1) = t1: P(i, 2) = t2: P(i, 3) = t3: P(i, 4) = t4
End If
1 If t5 <> "" Then
x = t1 & t2 & t3 & t5
With Sheets("2")
Set P = .Range("A3:D" & .Range("A" & .Rows.Count).End(xlUp).Row)
End With
tablo = P 'matrice, plus rapide
For i = 1 To UBound(tablo)
If x = tablo(i, 1) & tablo(i, 2) & tablo(i, 3) & tablo(i, 4) Then GoTo 2
Next
P(i, 1) = t1: P(i, 2) = t2: P(i, 3) = t3: P(i, 4) = t5
End If
End If
End If
2 Next
End Sub