XLA routines: EE_NextBusinessDay

Nick's picture
EE_NextBusinessDay takes a date, and a holiday calendar and returns the next business day.
Function EE_NextBusinessDay(rngHolidays As range, dt As Date) As Date
'Takes a date, a range of holidays, and returns the next business day
    Dim intNext     As Integer
    Dim dtNext      As Date
 
'http://excelexperts.com/xla-routines-eeNextBusinessDay    for updates on this function

    intNext = 1
    Do While True
        dtNext = DateAdd("d", intNext, dt)
        If EE_IsBusinessDay(rngHolidays, dtNext) Then
            EE_NextBusinessDay = dtNext
            Exit Function
        End If
        intNext = intNext + 1
    Loop
End Function