ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   I'd like to conditionally format a cell based on today's date (https://www.excelbanter.com/excel-discussion-misc-queries/199459-id-like-conditionally-format-cell-based-todays-date.html)

0to60

I'd like to conditionally format a cell based on today's date
 
I have a column that contains important dates, and I'd like to say make the
forecolor red if they're 3 months away, blue if their 6 months away, etc...

How do I do this?


David Biddulph[_2_]

I'd like to conditionally format a cell based on today's date
 
Look up "conditional formatting" in Excel help.
--
David Biddulph

"0to60" wrote in message
...
I have a column that contains important dates, and I'd like to say make the
forecolor red if they're 3 months away, blue if their 6 months away, etc...

How do I do this?




Greg Glynn

I'd like to conditionally format a cell based on today's date
 
On Aug 20, 2:32*pm, "0to60" wrote:
I have a column that contains important dates, and I'd like to say make the
forecolor red if they're 3 months away, blue if their 6 months away, etc....

How do I do this?


This will set it up for you:

Sub SetUpConditions()

Range("B2").Select
With Range("B2")
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=$B$2=INT(NOW())+180"
.FormatConditions(1).Font.ColorIndex = 2
.FormatConditions(1).Interior.ColorIndex = 5
.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=$B$2=INT(NOW())+90"
.FormatConditions(2).Font.ColorIndex = 2
.FormatConditions(2).Interior.ColorIndex = 3
End With

End Sub

Then have a look at Format - Conditonal Formatting to tweak it. Hope
this helps.


All times are GMT +1. The time now is 06:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com