Macro using dates

1 view
Skip to first unread message


Jul 1, 2003, 1:25:42 PM7/1/03
I would like to write a macro that will make the
background color of the cells change depending on what
date is in the individual cell. For example, a cell that
shows a date that occurs this week will be in yellow, a
date that will occur in the future will appear green, etc.
What makes this challenging is that I want to make it so
that the macro will continually change as the date
changes, so that it does not need to be re-written on a
weekly basis.

Myrna Larson

Jul 1, 2003, 2:28:38 PM7/1/03
If you have a default color plus at most three other options, you can use conditional formatting
for this.

The formula for a future date would be


The formula for a date that is in the current calendar week (beginning with Sunday) is


You must enter the conditions in the correct order: the first one to return TRUE is the one that
Excel uses. If you want dates that are in the current week but after today to colored as future
dates, the condition for future dates must be entered first, the condition for dates this week

If you want all dates in the current week, past, present, and future, to be yellow, you need to
enter this as the first condition




as the 2nd condition.

Reply all
Reply to author
0 new messages