Private Sub CommandButton1_Click()
Dim num As Object, data As Object, col As Range, lig As Variant, L&
Set num = TextBox1: Set data = TextBox2: Set col = [E:E]
'---tests sur num---
If Not IsNumeric(num) Then num = "": num.SetFocus: Exit Sub
If Application.CountIf(col, num) Or Val(num) <> Int(num) Then num = "": num.SetFocus: Exit Sub
lig = Application.Match(Val(num), col)
If IsError(lig) Then num = "": num.SetFocus: Exit Sub
'---tests sur data---
If Not IsDate(data) Then data = "": data.SetFocus: Exit Sub
L = lig + 1
While Cells(L, "B") <> "" And col(L) = "" 'boucle en cas de numéro manquant
L = L + 1
Wend
If CDate(data) < Cells(lig, "B") Or CDate(data) > [B:B].Find("*", Cells(L - 1, "B"), xlValues) Then data = "": data.SetFocus: Exit Sub
'---insertions de lignes et remplissages des cellules---
Application.ScreenUpdating = False
If Cells(L, "B") <> "" Then Rows(L).Insert
Cells(lig, "A").Copy Cells(L, "A"): Cells(lig, "C").Copy Cells(L, "C")
Cells(L, "B") = CDate(data)
Cells(L, col.Column) = Val(num)
If Cells(L + 1, "B") > Cells(L, "B") Then Rows(L + 1).Insert: _
Cells(L, "A").Copy Cells(L + 1, "A"): Cells(L, "C").Copy Cells(L + 1, "C")
If Cells(lig, "B") < Cells(L, "B") Then Rows(L).Insert: _
Cells(lig, "A").Copy Cells(L, "A"): Cells(lig, "C").Copy Cells(L, "C")
'---RAZ---
num = "": data = "": num.SetFocus
End Sub