Bonjour à tous,
Mon problème du dessus est résolu
maintenant j'ai un autre problème sur mon calendrier
Sub Init_Cal(Optional Dt As Date) qui se met en jaune avec l'erreur .Label_MY.Caption = Format(Dt, "mmmm yyyy") "
Merci à tous pour votre aide
Sub Init_Cal(Optional Dt As Date)
Dim Annee As Integer, Mois As Byte
Dim index As Byte, i As Integer, j As Integer, d As Date
Dim T As Variant, idx As Byte
With UserForm1
Dt = IIf(Dt = 0, Now, Dt)
.Label_MY.Caption = Format(Dt, "mmmm yyyy") "
Annee = Year(Dt)
Mois = Month(Dt)
index = Weekday(DateSerial(Annee, Mois, 1)) - 1
If index = 0 Then index = 7
T = TFeries(Annee)
idx = 0
For i = 0 To 41
d = DateAdd("d", i - index + 1, DateSerial(Annee, Mois, 1))
Jrm(i) = d
With .Controls("J" & i + 1)
.Caption = Day(d)
.ForeColor = IIf(Month(d) = Mois, &H404040, &HC0C0C0)
.BackColor = &HFFFFFF
.ControlTipText = ""
For j = 1 To 13
If d = T(j, 1) Then
.BackColor = &HE0E0E0
.ControlTipText = T(j, 0)
End If
Next j
If d = Date Then .BackColor = &HC0FFC0
End With
idx = idx + 1
If idx = 7 Then idx = 0
Next i
End With
End Sub