BusinessDateAdd

Counts the number of business days
Add or subtract a number of business days from a date
No holidays calculated yet.

CodeFunctionName
What is this?

Public

Not Tested

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

ByVal days As Long, ByVal StartDate As Date, Optional ByVal SaturdayIsHoliday As Boolean = True

Views 102

Downloads 55

CodeID
DB ID

ANmarAmdeen
610
Attachments
Revisions

v1.0

Wednesday
October
11
2023