XLA routines: EE_FirstDayOfMonth

Nick's picture
EE_FirstDayOfMonth takes a date and returns the first business day of the month that the date is in.
Function EE_FirstBusinessDayOfMonth(dt As Date, rngHolidays As range) As Date
'- as above but rolls to the next business day if the first bus day is a hol
'- also takes a range with the holiday calendar
'http://excelexperts.com/xla-routines-eeFirstBusinessDayOfMonth    for updates on this function

    If EE_IsBusinessDay(rngHolidays, EE_FirstDayOfMonth(dt)) Then
        EE_FirstBusinessDayOfMonth = EE_FirstDayOfMonth(dt)
        EE_FirstBusinessDayOfMonth = EE_NextBusinessDay(rngHolidays, EE_FirstDayOfMonth(dt))
    End If
End Function