1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| Function estferie(cellule As Range) As Boolean
'Vrai si la valeur courante correspond a un jour férié
Application.Volatile
Dim Y As Long, i As Long, SylvesterDay As Date, SpecD, b As Long
Y = Year(cellule.Value)
b = Abs((Y Mod 4 = 0 And Y Mod 100 <> 0) Or (Y Mod 400 = 0))
SylvesterDay = DateSerial(Y, 1, 1) - 1
i = EASTER(Y) - SylvesterDay - b
'Pour la France (1 Mai = 121em jour d'une année NON-bissextile)
SpecD = Array(1 - b, 121, 128, 195, 227, 305, 315, 359, i + 1, i + 39, i + 50)
Y = cellule.Value - SylvesterDay - b
For i = 0 To UBound(SpecD)
estferie = Y = SpecD(i)
If estferie Then Exit For
Next
End Function
Function EASTER(Yr As Long) As Long
'*Dans la fonction originale, les données étaient de type Integer*
Dim Century As Long, Sunday As Long, Epact As Long, N As Long
Dim Golden As Long, LeapDayCorrection As Long, SynchWithMoon As Long
Golden = (Yr Mod 19) + 1
Century = Yr \ 100 + 1
LeapDayCorrection = 3 * Century \ 4 - 12
SynchWithMoon = (8 * Century + 5) \ 25 - 5
Sunday = 5 * Yr \ 4 - LeapDayCorrection - 10
Epact = (11 * Golden + 20 + SynchWithMoon - LeapDayCorrection) Mod 30
If Epact < 0 Then Epact = Epact + 30
If (Epact = 25 And Golden > 11) Or Epact = 24 Then Epact = Epact + 1
N = 44 - Epact
If N < 21 Then N = N + 30
N = N + 7 - ((Sunday + N) Mod 7)
EASTER = DateSerial(Yr, 3, N)
End Function |
Partager