Problème de compréhension de code

Aphroditeuh

XLDnaute Nouveau
Salut à tous,

Voici mon problème : je me suis inspirée d'un projet téléchargeable pour ma gestion des congés mais j'ai un peu de mal à comprendre tout le code.
Qqun pourrait-il éclairer ma lanterne svp ?

Voici le code en question :
Code:
Sub auto_open() 'Ouverture automatique
   On Error Resume Next
   Application.CommandBars("BarreColoriage").Delete
   CommandBars.Add ("BarreColoriage")
   CommandBars("BarreColoriage").Visible = True
   For i = 1 To Application.CountA([MesCouleurs]) + 1
      Set bouton = CommandBars("BarreColoriage").Controls.Add(Type:=msoControlButton)
      bouton.Style = msoButtonCaption
      bouton.Tag = Range("MotifsCongés")(i)
      bouton.OnAction = "'Coloriage """ & i & """'"
      bouton.Caption = Range("MesCouleurs")(i)
   Next i
End Sub
Sub Coloriage(p)
   Application.Calculation = xlCalculationManual
   Application.ScreenUpdating = False
   For Each c In Selection
         c.Value = Range("MesCouleurs")(p).Value
         ' C.Interior.ColorIndex = Range("MesCouleurs")(p).Interior.ColorIndex
         Range("MesCouleurs")(p).Copy c
         If Range("MotifsCongés")(p) <> "" Then
             If c.Comment Is Nothing Then c.AddComment ' Création des  commentaires
             c.Comment.Shape.OLEFormat.Object.Font.Name = "Tverdana" 'Définis la police
             c.Comment.Shape.OLEFormat.Object.Font.Size = 7 'Défini la taille de la police
             c.Comment.Shape.OLEFormat.Object.Font.FontStyle = "Normal" 'Défini le style de la police
             temp = Range("MotifsCongés")(p)
             c.Comment.Text Text:=temp
             c.Comment.Shape.TextFrame.AutoSize = True
             c.Comment.Visible = False
         Else
             c.ClearComments
         End If
    Next c
    Application.Calculation = xlCalculationAutomatic
End Sub
Sub auto_close()
    On Error Resume Next
    Application.CommandBars("BarreColoriage").Delete
End Sub
Bonne journée à tous et bon week-end

Amicalement

Aphroditeuh
 

Statistiques des forums

Discussions
312 685
Messages
2 090 946
Membres
104 705
dernier inscrit
Mike72