| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 
 | Option Explicit
 
Sub NouvelleAnnee()
Dim NomFeuille As String
Dim An As Integer
Dim Couleur
 
  Couleur = Array(3, 4, 5, 6, 7, 8, 9, 10, 17, 40, 49, 42)
  With ActiveSheet
    An = Val(Split(.Name, " ")(1))
    If An = 0 Then
      MsgBox "Nom de la feuille non conforme"
      Exit Sub
    End If
    .Unprotect
    NomFeuille = "Charges " & An + 1 'Espace après Charges affiche Charges 2014.Supprimer Espace affiche Charges2014
 
    .Copy after:=Sheets(Sheets.Count)
    '.Shapes("AnneePlus").Delete     'Mettre en commentaires pour ne pas effacer le bouton (nouvelle année)de la Feuille Précédente
    .Protect
  End With
  With ActiveSheet
    .Name = NomFeuille
    .Tab.ColorIndex = Couleur((An - 2000) Mod 12)
    .Range("E3:E4,A8:C11,E8:E16,A26:C29,E26:E34,A44:C47,E44:E52,A62:C65,E62:E70,F5,F23,F41,F59,G8:I16,G26:I34,G44:I52,G62:I70").ClearContents
    '.Range("E3:E4,A8:C11,E8:E16,A26:C29,E26:E34,A44:C47,E44:E52,A62:C65,E62:E70,F5,F23,F41,F59,G8:I16,G26:I34,G44:I52,G62:I70").Interior.ColorIndex = 3
    .Range("A1").Select
  End With
End Sub | 
Partager