Private Sub Worksheet_Change(ByVal Target As Range)
Dim data As Range, num As Range, col As Range, lig As Variant
Set data = [G1]: Set num = [I1]: Set col = [E:E]
If Intersect(Target, Union(data, num)) Is Nothing Then Exit Sub
Target.Select
'---tests sur num---
If CStr(num) = "" Then Exit Sub
If Not IsNumeric(num) Then num = "": Exit Sub
If Application.CountIf(col, num) Or num <> Int(num) Then num = "": Exit Sub
lig = Application.Match(num, col)
If IsError(lig) Then num = "": Exit Sub
'---tests sur data---
If CStr(data) = "" Then Exit Sub
If Not IsDate(data) Then data = "": Exit Sub
If data <> Cells(lig, "B") And data <> Cells(lig, "B") + 1 Then data = "": Exit Sub
'---insertions de lignes et remplissages des cellules---
If Cells(lig + 1, "B") <> "" Then Rows(lig + 1).Insert: _
Cells(lig, "A").Copy Cells(lig + 1, "A"): Cells(lig, "C").Copy Cells(lig + 1, "C")
Cells(lig + 1, "B") = data
Cells(lig + 1, col.Column) = num
If Cells(lig + 2, "B") > Cells(lig + 1, "B") Then Rows(lig + 2).Insert: _
Cells(lig + 1, "A").Copy Cells(lig + 2, "A"): Cells(lig + 1, "C").Copy Cells(lig + 2, "C")
If Cells(lig, "B") < Cells(lig + 1, "B") Then Rows(lig + 1).Insert: _
Cells(lig, "A").Copy Cells(lig + 1, "A"): Cells(lig, "C").Copy Cells(lig + 1, "C")
End Sub