RWayneH
asked on
Is ActiveCell > or < today?
Must be doing something wrg. Every date I give it is less than today. Using yyyy-mm-dd format, tried formatting data as ShortDate, General, and others... still can not get this to recognize a date as in the future? It does not give me a positive number for 9999-12-31? Any ideas? Please advise and thanks.
TargetDate = ActiveCell.Value 'format?
Diff = DateDiff("d", Now, TargetDate)
If Diff < 0 Then
MsgBox ("Date is in the past, less than today" & Diff)
ElseIf Diff > 0 Then
MsgBox ("Date is in the future, greater than today" & Diff)
End If
Are your target cells formatted as date?
ASKER
I tried that formatted as ShortDate
ASKER
Tried it again and it worked. arg.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yup, had to use: Selection.NumberFormat = "m/d/yyyy"
Is there anything else I can do for you here?
ASKER
Thanks
You're welcome.