Date Comparison

jkfeagle

Codus Confusious
Local time
Today, 05:42
Joined
Aug 22, 2002
Messages
166
Alright, this has got to be simple but my brain is so drained from the day I can't get it right. I need a vba formula to determine if the current date is after April 1 of the current year. My weary melon thanks you in advance.
 
Code:
Function AfterApr1() As Boolean
   AfterApr1 = (Date > DateSerial(Year(Date), 4, 1))
End Function
 
use this
Code:
 If DatePart("m", Date) > 4 Then
 MsgBox "Greater than April"
 End If

This might solve your problem

Khalid
 
Last edited:
You may find the Month() function easier to work with.

If Month(Date()) > 4 Then

End If
 

Users who are viewing this thread

Back
Top Bottom