Thread: Compare 2 dates
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default Compare 2 dates

One way:

If Date = DateSerial(2004, 11, 1) And _
Date <= DateSerial(2004, 11, 26) Then MsgBox "Warning"


alternatively

If Date = #11/1/2004# And Date <= #11/26/2004# Then MsgBox "Warning"


In article ,
"Terri" wrote:

Hello,
How can I compare today's date to 2 other dates? Example:

fDate = Left$(Date$, 2) & Mid$(Date$, 4, 2) & Right$(Date$, 4)
If fDate is equal to or greater than(=) Nov.1,2004 AND equal to or less
than(=<) Nov.26,2004 Then MsgBox "Warning!"