Hello All,
I've created a Macro that takes Data from daily reports and imports them into a master work book, within that macro I have a "Date Check" to insure that there are no common errors( Wrong year, wrong month). At first it seem to work fine, but now no matter what the date on the Daily Report, I recieve my message prompt asking if I would like to continue... am I using the date function properly ?
Dim Today As Double Today = Worksheets("Daily Report(WR)").Cells(6, "C").Value LoopExit = 0 If Today - 30 < Date - 30 Then If MsgBox("This Daily Report(WR) is over 30 Days old. Would you like to Continue Anyway?", vbYesNo + vbQuestion, "Search Not Found") = vbNo Then Exit Sub End If End If If Today >= Date + 1 Then If MsgBox("This Daily Report(WR) seems to be from the future? Would you like to Continue Anyway? Suggest that the report date be checked for errors.", vbYesNo + vbQuestion, "Search Not Found") = vbNo Then Exit Sub End If End If
I'd use a different variable name than Today as it's a reserved word for an Excel worksheet function. Try using CurrentDate instead of Today.
If your question has been satisfactorily addressed, please consider marking it solved. Click here to see how.
Also, you might want to add to the user's reputation by clicking the scales icon - it's why we do what we do...
Thomas Lafferty
Analyst/Programmer
Thanks for the advice tlaffery but still no luckI get the same thing ... the Report Date is Sept 27 2011 and the prompt still says its 30 days old
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks