How can I check if a date falls within 2 dates.
i.e.
If 01/14/2011 is falls within 09/30/2010 and 10/01/2011 then
msgbox "Yes"
else
Msgbox "No"
Thanks for you help
How can I check if a date falls within 2 dates.
i.e.
If 01/14/2011 is falls within 09/30/2010 and 10/01/2011 then
msgbox "Yes"
else
Msgbox "No"
Thanks for you help
Hi Aviator,
Something like:
[VBA]
Option Explicit
Sub example()
Dim dtmMyDate As Date
Const MIN_DATE = #9/30/2010#
Const MAX_DATE = #10/1/2011#
dtmMyDate = DateSerial(2011, 1, 14)
If dtmMyDate > MIN_DATE And dtmMyDate < MAX_DATE Then
MsgBox "Yep"
Else
MsgBox "Nope"
End If
End Sub
[/VBA]
Hope that helps,
Mark
By formula, a simple
=IF(AND(H2>=H3,H2<=H4),"Yes","No")
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber