I am confused - is the criteria:
>= ThisDate
or
Between ThisDate AND AnotherDate
Okay, think I almost get the issue. If it is Jan, Mar, May, Jul, Aug, Oct, Dec the last day will be 31; Apr, Jun, Sep, Nov will be 30; and Feb will be 28 or 29. This would have to be built into the custom function. Something like:
Code:
Public Function GetDate() As Date
Dim IsLast() As Boolean
Select Case Month(Date())
Case 1, 3, 5, 7, 8, 10, 12
If Day(Date()) = 31 Then IsLast = True
Case 4, 6, 9, 11
If Day(Date()) = 30 Then IsLast = True
Case 2
If Day(Date()) = 29 Then
IsLast = True
ElseIf Day(Date()) = 28 And Not IsDate("2/29/" & Year(Date())) Then
IsLast = True
End If
End Select
If IsLast = True Then
GetDate = 'this
Else
GetDate = 'this
End If
End Function
As you can see, February is tricky because of leap year.
However, I still don't really understand the criteria and the conditions for changing.