XLA routines: EE_AddBusinessDays

EE_AddBusinessDays takes a date, and a holiday calendar and adds business days.
Function EE_AddBusinessDays(dt As Date, rngHolidays As range, intBusinessDays As Integer) As Date 'Takes a date, a range of holidays, business days, and adds that amount of business days to the date. Should work with negative days to subtract instead of add If intBusinessDays = 0 Then EE_AddBusinessDays = dt Exit Function End If Dim intDays As Integer Dim intLoop As Integer Dim dtNew As Date 'http://excelexperts.com/xla-routines-eeAddBusinessDays for updates on this function dtNew = dt intDays = Abs(intBusinessDays) If intBusinessDays < 0 Then 'subtract For intLoop = 1 To intDays dtNew = EE_PrevBusinessDay(rngHolidays, dtNew) Next intLoop Else 'Add For intLoop = 1 To intDays dtNew = EE_NextBusinessDay(rngHolidays, dtNew) Next intLoop End If EE_AddBusinessDays = dtNew End Function
»
- Nick's blog
- Login or register to post comments
- 2890 reads
Recent comments
5 years 50 weeks ago
6 years 36 weeks ago
6 years 47 weeks ago
6 years 50 weeks ago
6 years 51 weeks ago
7 years 5 weeks ago
7 years 13 weeks ago
7 years 13 weeks ago
7 years 13 weeks ago
7 years 13 weeks ago