Bonjour,
Dans ton code fais attention avec
Month(Now) - 1 si le mois est janvier
SINON,
voici un exemple de procédure qui permet de créer
un calendrier et de le placer dans une variable tableau
Le code est un peu long et détaillé mais efficace à 100 %
...
Public Sub MyCalendar(Annee As Integer)
On Error GoTo err_j
Dim Jours() As String
ReDim Jours(366)
Dim i As Integer
Dim Pas As Integer
'Janvier
For i = 1 To 31
Jours(i) = Format$(i, "00") & "/" & "01" & "/" & Format$(Annee, "00")
Next
Pas = 31
'Fevrier
For i = 1 To 28
Jours(i + Pas) = Format$(i, "00") & "/" & "02" & "/" & Format$(Annee, "00")
Next
Pas = Pas + 28
'Année bissextile
If Annee Mod 4 = 0 Then
Pas = Pas + 1
Jours(60) = "29" & "/" & "02" & "/" & Format$(Annee, "00")
End If
'Mars
For i = 1 To 31
Jours(i + Pas) = Format$(i, "00") & "/" & "03" & "/" & Format$(Annee, "00")
Next
Pas = Pas + 31
'Avril
For i = 1 To 30
Jours(i + Pas) = Format$(i, "00") & "/" & "04" & "/" & Format$(Annee, "00")
Next
Pas = Pas + 30
'Mai
For i = 1 To 31
Jours(i + Pas) = Format$(i, "00") & "/" & "05" & "/" & Format$(Annee, "00")
Next
Pas = Pas + 31
'Juin
For i = 1 To 30
Jours(i + Pas) = Format$(i, "00") & "/" & "06" & "/" & Format$(Annee, "00")
Next
Pas = Pas + 30
'Juillet
For i = 1 To 31
Jours(i + Pas) = Format$(i, "00") & "/" & "07" & "/" & Format$(Annee, "00")
Next
Pas = Pas + 31
'Aout
For i = 1 To 31
Jours(i + Pas) = Format$(i, "00") & "/" & "08" & "/" & Format$(Annee, "00")
Next
Pas = Pas + 31
'Septembre
For i = 1 To 30
Jours(i + Pas) = Format$(i, "00") & "/" & "09" & "/" & Format$(Annee, "00")
Next
Pas = Pas + 30
'Octobre
For i = 1 To 31
Jours(i + Pas) = Format$(i, "00") & "/" & "10" & "/" & Format$(Annee, "00")
Next
Pas = Pas + 31
'Novembre
For i = 1 To 30
Jours(i + Pas) = Format$(i, "00") & "/" & "11" & "/" & Format$(Annee, "00")
Next
Pas = Pas + 30
'Décembre
For i = 1 To 31
Jours(i + Pas) = Format$(i, "00") & "/" & "12" & "/" & Format$(Annee, "00")
Next
End Sub
...
sacré fêtard, régales toi avec les illuminations
et reviens-nous illuminé 