Private Sub Worksheet_Change(ByVal Target As Range)
Dim lig As Variant, piece As Variant
lig = Application.Match("S.TOTAUX", [A:A], 0)
If IsError(lig) Then MsgBox "Il faut ""S.TOTAUX"" en colonne A !", 48: Exit Sub
If IsEmpty(Cells(lig - 1, 1)) Then Exit Sub
Application.ScreenUpdating = False
Application.EnableEvents = False 'désactive l'action des événements
Me.AutoFilterMode = False 'désactive le filtre automatique
Rows(lig).Insert
Rows(1).Copy Rows(lig) 'pour les formats
Rows(lig).ClearContents
If lig > 3 Then
piece = Cells(lig - 1, 1) 'mémorise
Rows(1).Copy Rows(lig - 1) 'pour les formules
Cells(lig - 1, 1) = piece
End If
Rows(lig - 1).Resize(2).Hidden = False 'affiche les lignes masquées
[A2:H2].Resize(lig - 2).AutoFilter 'replace le filtre automatique
Application.EnableEvents = True
End Sub