Sub Mise_à_Jour5()
Dim a, code, n As Byte, c, cel As Range, i&
a = Array(Feuil1, Feuil2) 'CodeNames des feuilles à traiter
code = Array("D712", "D727") 'codes à traiter
Application.ScreenUpdating = False
For Each c In code
For n = 0 To UBound(a)
Set cel = a(n).[B:B].Find(c, , xlValues, xlWhole, , xlPrevious)
If Not cel Is Nothing Then
cel(2).EntireRow.Insert 'ligne entière
cel.Resize(, 12).Copy cel(2)
cel.Resize(, 12) = cel.Resize(, 12).Value 'supprime les formules
cel(2, 4) = IIf(n, DateAdd("yyyy", 1, cel(2, 4)), a(1).Cells(cel(2).Row - 1, "M"))
cel(2, 5) = IIf(n, DateAdd("yyyy", 1, cel(2, 5)), 0)
i = Application.Match(c, a(n).[B:B], 0)
For i = cel(0).Row To i Step -1
If a(n).Cells(i, 2) = c Then a(n).Rows(i).Delete
Next
End If
Next
Next
End Sub