devxlogo

BusinessDateAdd – Add or subtract a number of business days from a date

BusinessDateAdd – Add or subtract a number of business days from a date

' add or subtract a number of business days from a date'' Note that it doesn't take Christmas, Easter and' other holidays into accountFunction 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 = StartDateEnd Function

See also  Does It Make Sense to Splurge on a Laptop?
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist