Displaying  Source Code(s)  
 

 
Number of Business Days

--------------------------------------------------------------------------------

Description : Counts the number of business days

add or subtract a number of business days from a date
'
' Note that it doesn't take Christmas, Easter and
' other holidays into account

Function BusinessDateAdd(ByVal days As Long, ByVal StartDate As Date, _
Optional ByVal SaturdayIsHoliday As Boolean = True) As Date
Do While days
' increment or decrement the date
StartDate = StartDate + Sgn(days)
' check that it is a week day
If Weekday(StartDate) <> vbSunday And (Weekday(StartDate) <> vbSaturday _
Or Not SaturdayIsHoliday) Then
' days becomes closer to zero
days = days - Sgn(days)
End If
Loop
BusinessDateAdd = StartDate
End Function

--------------------------------------------------------------------------------

 

Contribute content or training reports / feedback / Comments
job placement papers
All rights reserved © copyright 123ENG