ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Compare current date to 2 dates (https://www.excelbanter.com/excel-programming/314280-compare-current-date-2-dates.html)

Terri

Compare current date to 2 dates
 
Hello,
How can I compare the current date to 2 other dates. Example:
fDate = Left$(Date$, 2) & Mid$(Date$, 4, 2) & Right$(Date$, 4)
I need a MsgBox to open if fDate is equal to or greater(=) than Nov. 1,
2004 AND equal to or less than(=<) Nov. 26, 2004.
Thank you for your help,
Terri

Tom Ogilvy

Compare current date to 2 dates
 
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 the current date to 2 other dates. Example:
fDate = Left$(Date$, 2) & Mid$(Date$, 4, 2) & Right$(Date$, 4)
I need a MsgBox to open if fDate is equal to or greater(=) than Nov. 1,
2004 AND equal to or less than(=<) Nov. 26, 2004.
Thank you for your help,
Terri





All times are GMT +1. The time now is 06:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com