> ## Content Index
> Fetch the complete content index at: https://nolongerset.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# IsLastBusinessDayOfMonth() Function
- URL: https://nolongerset.com/islastbusinessdayofmonth-function/
- Published: 2021-02-04T03:16:59.000Z
- Updated: 2026-05-08T13:06:34.000Z
- Description: I bet you can't guess what this function does.
- Author: Mike Wolfe
- Tags: Code Library, #Date Functions, #Import 2026-05-20 02:59

One of our Access applications integrates with a reporting system that releases certain reports on the last business day of each month. Thus, I wrote the not-so-cleverly named **IsLastBusinessDayOfMonth**() function to test that condition.

For most purposes, a business day is any day except a Saturday, Sunday, or federal holiday. This function builds off of previous functions that take each of those exceptions into consideration. Those other functions are [**IsBusinessDay**()](https://nolongerset.com/vba-isbusinessday-function/), [**IsEndOfMonth**(), and **MonthEnd**()](https://nolongerset.com/convenience-date-functions/). 

Note that the unusual `'>>>` comment syntax in the code below is used to create Python-inspired [doc tests](https://nolongerset.com/python-inspired-doc-tests-in-vba/), which both verify the correctness of the function and document its usage.

## The Code

```vba
'---------------------------------------------------------------------------------------
' Procedure : IsLastBusinessDayOfMonth
' Author    : Mike Wolfe (https://nolongerset.com)
' Date      : 11/21/2014
' Purpose   : Returns whether the given date is the last business day of the month.
'>>> IsLastBusinessDayOfMonth(#9/11/2001#)
' False
'>>> IsLastBusinessDayOfMonth(#5/31/2010#) Or IsLastBusinessDayOfMonth(#5/30/2010#) Or IsLastBusinessDayOfMonth(#5/29/2010#)
' False
'>>> IsLastBusinessDayOfMonth(#5/29/2010#, True)
' True
'>>> IsLastBusinessDayOfMonth(#5/28/2010#, True)
' False
'>>> IsLastBusinessDayOfMonth(#5/28/2010#)
' True
'>>> IsLastBusinessDayOfMonth(#5/27/2010#)
' False
'>>> IsLastBusinessDayOfMonth(#6/30/2010#)
' True
'---------------------------------------------------------------------------------------
'
Function IsLastBusinessDayOfMonth(AsOf As Date, Optional CountSatAsBusDay As Boolean = False) As Boolean
    'Is it even a business day?
    If IsBusinessDay(AsOf, CountSatAsBusDay) Then
        If IsEndOfMonth(AsOf) Then
            IsLastBusinessDayOfMonth = True
        Else
            Dim CurDay As Date
            For CurDay = MonthEnd(AsOf) To AsOf Step -1
                If IsBusinessDay(CurDay, CountSatAsBusDay) Then
                    If AsOf = CurDay Then
                        IsLastBusinessDayOfMonth = True
                    Else
                        Exit For
                    End If
                End If
            Next CurDay
        End If
    End If
End Function
```

*Image by [Susanne Sailer](https://pixabay.com/users/susanne%5Fsailer-1178482/?utm%5Fsource=link-attribution&utm%5Fmedium=referral&utm%5Fcampaign=image&utm%5Fcontent=4559145) from [Pixabay](https://pixabay.com/?utm%5Fsource=link-attribution&utm%5Fmedium=referral&utm%5Fcampaign=image&utm%5Fcontent=4559145)*