Thread: Compare 2 dates
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Terri Terri is offline
external usenet poster
 
Posts: 110
Default Compare 2 dates

Tom,
Sorry for the re-post. I got an error on the 1st post and didn't realize it
actually posted. Also, I used your code example and it worked perfectly for
me. Many, many thanks!
Terri

"Tom Ogilvy" wrote:

What was wrong with the answer to your original post?

Don't use strings.

Dim dt as Date
dt = Date ' todays date as an example.
if Dt DateSerial(2004,11,1) and Dt < DateSerial(2004,11,26) then

End if

--
Regards,
Tom Ogilvy


"Terri" wrote in message
...
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!"