Wil Moosa
Well-known Member
- Joined
- Aug 11, 2002
- Messages
- 893
The following code allows the user to write in any cell "=Pasen(2004)" -meaning "=Eastern(2004)- showing the date of Eastern in 2004. Any year can be filled in.
Public Function Pasen(Jaar As Integer)
Dim a, b, c, d, e, m, n, s
a = Jaar Mod 19
b = Jaar Mod 4
c = Jaar Mod 7
s = Int(Jaar / 100)
m = 10 + s - Int(s / 4) - Int((s - 14 - Int((s + 8) / 25)) / 3)
n = (4 + s - Int(s / 4)) Mod 7
d = (m + 19 * a) Mod 30
If (d = 28) And (a >= 11) Then d = 27
If d = 29 Then d = 28
e = (n + 2 * b + 4 * c + 6 * d) Mod 7
Pasen = DateValue("21 maart" & Str(Jaar)) + d + e + 1
End Function
This code works fine when put in a workbook with no other modules and code around. It even works fine in a workbook with other code... but it does not work in the workbook where i want it to work.
The error message I get is: "Compilation error; can not find the project or the library". In the last line of the code "Str" is highlighted.
What is it I am doing wrong here?
Public Function Pasen(Jaar As Integer)
Dim a, b, c, d, e, m, n, s
a = Jaar Mod 19
b = Jaar Mod 4
c = Jaar Mod 7
s = Int(Jaar / 100)
m = 10 + s - Int(s / 4) - Int((s - 14 - Int((s + 8) / 25)) / 3)
n = (4 + s - Int(s / 4)) Mod 7
d = (m + 19 * a) Mod 30
If (d = 28) And (a >= 11) Then d = 27
If d = 29 Then d = 28
e = (n + 2 * b + 4 * c + 6 * d) Mod 7
Pasen = DateValue("21 maart" & Str(Jaar)) + d + e + 1
End Function
This code works fine when put in a workbook with no other modules and code around. It even works fine in a workbook with other code... but it does not work in the workbook where i want it to work.
The error message I get is: "Compilation error; can not find the project or the library". In the last line of the code "Str" is highlighted.
What is it I am doing wrong here?