Sub Affiche()
Dim X As String, PQ As Double
mois = Month(newdate)
an = Year(newdate)
' ****** date Pâques d'aprés prasadv@md2.vsnl.net.in
PQ = Evaluate("TRUNC(DATE(" & an & ",7,-CODE(MID(""NYdQ\JT_LWbOZeR]KU`"",MOD(" & an & ",19)+1,1)))/7)*7+8")
TB_AN.Value = Format(newdate, "yyyy")
TB_Mois.Value = Format(newdate, "mmmm")
DoEvents
' ****** décalage début de mois
l = lundi(Month(newdate), Year(newdate))
For N = 1 To 38
With Controls("CommandButton" & N)
.Caption = Format(l + N - 1, "d")
.BackColor = IIf(Weekday(l + N - 1, vbMonday) > 5, &HC0C0FF, &HC0FFFF)
' ****** hors période
If Format(l + N - 1, "mmmm") <> TB_Mois Then
.Enabled = False
.Font.Bold = False
.BackColor = vbWhite
Else
.Enabled = True
.Font.Bold = True
' ****** aujourd'hui
If l + N - 1 = Date Then '------------------------------Ici
.BackColor = vbGreen
.ControlTipText = Format(Date, "dddd d mmmm yyyy") & " Aujourd'hui"
.SetFocus
End If
' ****** féries légaux
X = Format(l + N - 1, "ddmm")
Select Case X
Case "0101"
.BackColor = &HFFFFC0
.ControlTipText = Format(l + N - 1, "dddd d mmmm yyyy") & " Jour de l'an"
Case "0105"
.BackColor = &HFFFFC0
.ControlTipText = Format(l + N - 1, "dddd d mmmm yyyy") & " Fête du travail"
Case "0805"
.ControlTipText = Format(l + N - 1, "dddd d mmmm yyyy") & " Victoire 1945"
.BackColor = &HFFFFC0
Case "1407"
.BackColor = vbMagenta
.ControlTipText = Format(l + N - 1, "dddd d mmmm yyyy") & " Fête Nationale"
Case "1508"
.BackColor = &HFFFFC0
.ControlTipText = Format(l + N - 1, "dddd d mmmm yyyy") & " Assomption"
Case "0111"
.BackColor = &HFFFFC0
.ControlTipText = Format(l + N - 1, "dddd d mmmm yyyy") & " Toussaint"
Case "1111"
.BackColor = &HFFFFC0
.ControlTipText = Format(l + N - 1, "dddd d mmmm yyyy") & " Armistice 1918"
Case "2512"
.BackColor = &HFFFFC0
.ControlTipText = Format(l + N - 1, "dddd d mmmm yyyy") & " Noël"
Case Format(PQ + 1, "ddmm")
.BackColor = &HFFFFC0
.ControlTipText = Format(l + N - 1, "dddd d mmmm yyyy") & " Lundi de Pâques"
Case Format(PQ + 39, "ddmm")
.ControlTipText = Format(l + N - 1, "dddd d mmmm yyyy") & " Ascension"
.BackColor = &HFFFFC0
Case Format(PQ + 50, "ddmm")
.BackColor = &HFFFFC0
.ControlTipText = Format(l + N - 1, "dddd d mmmm yyyy") & " Lundi de Pentecôte (reportable)"
Case Else
.ControlTipText = Format(l + N - 1, "dddd d mmmm yyyy")
End Select
End If
End With
Next N
End Sub