Sub NouvelleAnnée()
Dim t$, rep As Byte, ar, a, c As Range
t = ActiveSheet.Name
If Not t Like "####-####*" Then Exit Sub
t = Val(t) + 1 & "-" & Val(t) + 2 & Mid(t, 10)
On Error Resume Next
If IsError(Sheets(t)) Then
rep = MsgBox("Voulez-vous écraser l'année en cours ?", 3, "Nouvelle année")
If rep = 2 Then Exit Sub 'bouton Annuler
Application.ScreenUpdating = False
If rep = 7 Then ActiveSheet.Copy After:=Sheets(Sheets.Count) 'nouvelle feuille
ActiveSheet.Name = t
'---nouvelles années---
[1:5].Replace Val(t) - 1, Val(t), xlPart
[1:5].Replace Val(t) - 2, Val(t) - 1
[1:5].Replace Val(t) - 3, Val(t) - 2
[1:5].Replace Val(t) - 4, Val(t) - 3
[A6:A65000].Replace Val(t), Val(t) + 1 'à voir
[A6:A65000].Replace Val(t) - 1, Val(t) 'à voir
'---translation des constantes numériques---
ar = Array("BQ6:CN65000", "AS6:BP65000", "U6:AR65000")
For Each a In ar
Range(a).Offset(, 24).SpecialCells(xlCellTypeConstants, 1).ClearComments
Range(a).Offset(, 24).SpecialCells(xlCellTypeConstants, 1).ClearContents
For Each c In Range(a).SpecialCells(xlCellTypeConstants, 1)
c.Copy c(1, 25)
Next
Next
'---RAZ---
[A6:AR65000].SpecialCells(xlCellTypeConstants, 1).ClearContents
End If
End Sub