Excel function usage

Solved
Hello,

I have a problem with something but I can’t figure out what’s wrong...

I have a function ESTFERIE that I want to use but it doesn’t seem to be recognized.

I’ve placed it in a module of my workbook (in the declarations, and I even put it in the workbook to test).

When I enter =ESTFERIE(B4) with B4 containing a date, I get a #NAME? error.

Here is the function

Public Function ESTFERIE(d As Date) As Boolean
Dim annee As Integer
Dim paques As Date
annee = Year(d)

' Algorithme de calcul de Pâques
Dim a, b, c, d_p, e, f, g, h, i, k, l, m, n, p As Integer
a = annee Mod 19
b = Int(annee / 100)
c = annee Mod 100
d_p = Int(b / 4)
e = b Mod 4
f = Int((b + 8) / 25)
g = Int((b - f + 1) / 3)
h = (19 * a + b - d_p - g + 15) Mod 30
i = Int(c / 4)
k = c Mod 4
l = (32 + 2 * e + 2 * i - h - k) Mod 7
m = Int((a + 11 * h + 22 * l) / 451)
n = Int((h + l - 7 * m + 114) / 31)
p = (h + l - 7 * m + 114) Mod 31

paques = DateSerial(annee, n, p + 1)

' Vérification des jours fériés
Select Case d
Case DateSerial(annee, 1, 1), DateSerial(annee, 5, 1), DateSerial(annee, 5, 8), _
DateSerial(annee, 7, 14), DateSerial(annee, 8, 15), DateSerial(annee, 11, 1), _
DateSerial(annee, 11, 11), DateSerial(annee, 12, 25), _
paques + 1, paques + 39, paques + 50
ESTFERIE = True
Case Else
ESTFERIE = False
End Select
End Function

Thanks for removing the sausage wrap from my eyes...

Best regards

2 answers

  • Votes
  • Date
  • Descending date
  1. Hello,

    For me, it works:

    https://www.swisstransfer.com/dl/01a11695-a82c-7201-b36e-4187238bba3b

    Daniel
    1. Thank you.

      I just understood my mistake!

      The macros were disabled without notification (the trap with the c..).

      See you later.