Private Sub Worksheet_Activate()
Cmt
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Range("A1"), Target) Is Nothing Then
Cmt
End If
End Sub
Sub Cmt()
Set f1 = Sheets("Accueil")
Set f2 = Sheets("base")
Set rng1 = f1.Range("C9:I14")
On Error Resume Next
rng1.ClearComments
On Error GoTo 0
Set Rng2 = f2.Range("C2:C" & f2.[C65000].End(xlUp).Row)
For Each c In Rng2
If Month(c) = f1.[A1] Then
Set result = rng1.Find(what:=Day(c.Value), LookIn:=xlValues)
If Not result Is Nothing Then
With result
.AddComment ' Création commentaire
.Comment.Shape.OLEFormat.Object.Font.Name = "Tverdana"
.Comment.Shape.OLEFormat.Object.Font.Size = 7
.Comment.Shape.OLEFormat.Object.Font.FontStyle = "Normal"
.Comment.Text Text:=Format(c.Offset(, 1), "hh:mm") & vbLf & c.Offset(, 2) & vbLf & c.Offset(, 4)
.Comment.Shape.TextFrame.AutoSize = True
End With
End If
End If
Next c
End Sub