silentwolf
Well-known Member
- Joined
- May 14, 2008
- Messages
- 1,216
- Office Version
- 2016
Hi guys,
I am stuck with following.
I got a function wich returns a boolean when a date ist a public holiday.. i found this code on the net.. works fine ...
However now I like to create a new function which returns the amount of hoidays within a range of dates.
The function "Feiertag" requires only one parameter a date and retourns true or false if the date is a holiday
But I like to get the amount of holidays out from the function above but somehow not really have luck to figure it out.
Can someone put me in the right direction please?
Many thanks
SW
I am stuck with following.
I got a function wich returns a boolean when a date ist a public holiday.. i found this code on the net.. works fine ...
However now I like to create a new function which returns the amount of hoidays within a range of dates.
VBA Code:
Function HolidaysWithinRange(datStart As Date, datEnd As Date) As Integer
Dim lngDays As Long
Application.Volatile
Dim lngCount As Long
For lngDays = 1 To CLng(datEnd - datStart)
If lngDays = 1 Then
Feiertag (datStart)
Else
Feiertag (datStart) + lngDays
End If
If Feiertag(datDate) = True Then
HolidaysWithinRange = HolidaysWithinRange + 1
End If
Next lngDays
End Function
The function "Feiertag" requires only one parameter a date and retourns true or false if the date is a holiday
But I like to get the amount of holidays out from the function above but somehow not really have luck to figure it out.
Can someone put me in the right direction please?
Many thanks
SW