Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim T As Range, i&
Set T = [Tableau2]
Application.EnableEvents = False
On Error Resume Next 'sécurité
If T.Rows.Count < 4 Then
Application.Undo 'annulation
Else
'---suppression des lignes vides---
For i = T.Rows.Count - 1 To 4 Step -1
If T(i, 1) = "" Then T(i, 1).EntireRow.Delete
Next
'---ajout de ligne---
If T(T.Rows.Count, 1) <> "" Then
Application.ScreenUpdating = False
T(T.Rows.Count, 1).EntireRow.Insert
T.Rows(T.Rows.Count - 1).FormulaR1C1 = T.Rows(T.Rows.Count).FormulaR1C1
T.Rows(T.Rows.Count) = ""
Application.ScreenUpdating = True
End If
End If
End Sub