I'm a newbie at VB and am trying to get some help with a process. My code will check an Excel file for dates and store them in a number of variables. Then I want to be able to compare those dates to the current date. I was thinking about using "Case", but is there a smoother, better way to do this? What I want is to basically say, "If any of these dates meet the criteria, then do something."


You can use DateDiff Function to Compare dates DateDiff(interval, date1, date2) Interval may be

yyyy -- Year
m - Month
y - Day of year
d - Day
w - Weekday
ww - Week
h - Hour
n - Minute
s - Second


Dim TheDate As Date   ' Declare variables.
Dim Msg as String
TheDate = InputBox("Enter a date")
Msg = "Days from today: " & DateDiff("d", Now, TheDate)
MsgBox Msg