Funkce:
Function
BusinessDateDiff(ByVal StartDate As Date, ByVal EndDate As Date, _
Optional ByVal SaturdayIsHoliday As Boolean = True) As
Long
Dim
incr As Date
StartDate = Int(StartDate)
EndDate = Int(EndDate)
'
krok může být +1 nebo -1
If
StartDate < EndDate Then incr = 1 Else incr = -1
Do
Until StartDate = EndDate
'
Přeskočení předchozího nebo následujícího dne
StartDate
= StartDate + incr
If Weekday(StartDate) <> vbSunday
And _
(Weekday(StartDate)
<> vbSaturday _
Or Not
SaturdayIsHoliday) Then
BusinessDateDiff
= BusinessDateDiff + incr
End If
Loop
End Function
|