Highlighting out of date cells [Closed]

Report
-
Posts
1862
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
July 30, 2015
-
Hello,
I have never made a macro before and not even sure if i need it for this task but hey here we go.

I need to highlight certain cells in red when the date inside is two weeks from going out of date. E.G.

Jam1 12/06/09
jam4 14/06/09
jam2 28/06/06

In this group if todays date was 1/06/09 then the top one will automatically go red.
How do i do this please?

Excel 2007

1 reply

Posts
1862
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
July 30, 2015
796
In excel dates must be entred as month/date/year e.g. 8/12/09
not as you have done. Of course you can format it as you like

besides today's date is 26th August 2009

your data is in A1 to B3. If it is more rows the macro will work

try this macro

Sub test()
Dim rng As Range, c As Range
Set rng = Range(Range("B1"), Range("B1").End(xlDown))
For Each c In rng
If c <= Date - 14 Then c.Interior.ColorIndex = 3
Next


End Sub
1
Thank you

A few words of thanks would be greatly appreciated. Add comment

CCM 2942 users have said thank you to us this month

Subscribe To Our Newsletter!

The Best of CCM in Your Inbox

Subscribe To Our Newsletter!