Check if Date within this week/last week
Duncan wrote:
For Each cl In Range("D1:D1000")
If cl.Value = Date Then
Now the above works perfectly, but I dont have a clue how I would now
go on to say is the date (cl.value) coming up in seven days time?
Excel stores dates as numbers, and a day is equal to '1'. Forward time
= larger numbers
So, saying "cl.value is less than 7 days from now" is exporessed as
if cl.value < date + 7
this will also find all dates in the past, which we may not want. 'In
the next week' becomes
if cl.value < date + 7 and cl.value <= date
HTH, post back if not.
Nik
|