Private Sub Worksheet_Change(ByVal Target As Range)
Dim r As Range, an%
Application.ScreenUpdating = False
Application.EnableEvents = False 'désactive les évènements
With ListObjects(1).Range 'tableau structuré
Set r = Intersect(Target, .Cells)
If Not r Is Nothing Then
For Each r In r.Areas
If Not Intersect(r, .Columns(18)) Is Nothing Then If r.Columns.Count < .Columns.Count Then Application.Undo: Exit For 'annule la modification
Next r
End If
.Columns(2).Insert xlToRight 'insère une colonne auxiliaire
.Columns(2) = "=ROW()": .Columns(2) = .Columns(2).Value 'numérotation
.Sort .Columns(16), xlAscending, Header:=xlYes 'tri sur la colonne 15 + 1
For Each r In .Columns(19).Cells 'colonne 18 + 1
If r = "" Then If Val(Replace(r(1, -4), ",", ".")) > 0 And IsDate(r(1, -2)) Then r = Application.Max(.Columns(19)) + 1: an = Year(CDate(r(1, -2)))
Next r
If an Then .Columns(19).NumberFormat = """" & an & "/""0" 'format personnalisé
.Sort .Columns(2), xlAscending, Header:=xlYes 'tri dans l'ordre initial
.Columns(2).Delete xlToLeft 'supprime la colonne auxiliaire
End With
Application.EnableEvents = True 'réactive les évènements
End Sub