ISDATELAST
Returns whether a date is the last of a week, month or year.
For instructions on how to add a function to a workbook refer to the page under Inserting Functions
ISDATELAST_OFAMONTH
Returns whether a date is the last day of the month.
Public Function ISDATELAST_OFAMONTH( _
Optional ByVal dtDateValue As Date) As Boolean
Dim iDay As Integer
Dim iMonth As Integer
Dim iYear As Integer
Dim iNoOfDays As Integer
Application.Volatile
If VBA.IsMissing(dtDateValue) Then
dtDateValue = VBA.Date
End If
iDay = VBA.Day(dtDateValue)
iMonth = VBA.Month(dtDateValue)
iYear = VBA.Year(dtDateValue)
iNoOfDays = VBA.Day(VBA.DateSerial(iYear, iMonth + 1, 1) - 1)
If (iDay = iNoOfDays) Then ISDATELAST_OFAMONTH = True
If (iDay < iNoOfDays) Then ISDATELAST_OFAMONTH = False
End Function
ISDATELAST_OFAWEEK
Returns whether a date is the last day of the week.
Public Function ISDATE_LASTOFAWEEK( _
Optional ByVal dtDateValue As Date) As Boolean
Application.Volatile
ISDATELAST_OFAWEEK = dtDateValue - VBA.Weekday(dtDateValue, vbUseSystemDayOfWeek) + 7
End Function
ISDATELAST_OFAYEAR
Returns whether a date is the last day of the year.
© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext