Module MainModule Public Function LastDayOfMonth(ByVal MonthYear As String) As Integer Return DatePart("d ", DateAdd("d ", -1, DateAdd("m ", 1, DateAdd("d ", -DatePart("d ", MonthYear) + 1, MonthYear)))) End Function End Module