Happy Eastern...

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?
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Will

Make sure you code for functions is located in a standard module.

If you have several functions... you may even condsider creating a module specifically for functions... and name it functions...

Only a organizational tip...

Hope this helps!
 
Upvote 0
Check your references (in VBE, under Tools...References). Check that none are marked "Missing", and that the usual references are all there (Visual Basic for Applications, Microsoft Excel x.0 Object Library, OLE Automation, Microsoft Office x.0 Object Library).
 
Upvote 0
Hi
I don't think that vba understand dutch so try and change

Pasen = DateValue("21 maart" & Str(Jaar)) + d + e + 1

to

Pasen = DateValue("21-mar" & Str(Jaar)) + d + e + 1
 
Upvote 0
I did check my references and found some missing ones (Kodak and Telefony). I unchecked them and... now it does work. I fiddled around a bit more so I can not say exactly what did the trick. :unsure:

Thank you for the suggestions...
 
Upvote 0

Forum statistics

Threads
1,207,290
Messages
6,077,558
Members
446,289
Latest member
excelmaster123_

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top