Macro to highlight date cells based on criteria linked to "today"'s date

Gti182

Board Regular
Joined
Dec 7, 2011
Messages
65
Hello,

I'm hoping someone can provide some code for below task. I've considered using conditional formatting for this but it slowed down the file quite noticeably which was already quite slow to start off with hence deciding on the macro route.

My aim is to highlight date cells appearing in columns N, P, R, T, V, X, Z, AB either in RED or AMBER/ORANGE if they fall into the below date criteria.

Highlight ORANGE - if the date is within 2 weeks of today's date (including today)
Highlight RED - if the date is within 2 weeks before today's date (excluding today)

i.e.
14 days <-----HIGHLIGHT RED------>TODAY<-----HIGHLIGHT AMBER------> 14 days

- Headings are in the first row and the dates start from row 2 and shouldn't populate more than a 1000 rows
- Some cells might be blank
- Macro would clear any highlighting it had previously made in these columns and insert new highlighting when re-activated on say a different day.
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Forum statistics

Threads
1,215,219
Messages
6,123,690
Members
449,117
Latest member
Aaagu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top