ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Conditional formatting of date (https://www.excelbanter.com/excel-discussion-misc-queries/32591-conditional-formatting-date.html)

cebubum

Conditional formatting of date
 
I want to compare a date in a cell to the current date. If the current date
is past the date in the specified cell, and the adjacent cell is blank, I
want the specified date to display in red. Would someone be so kind as to
assist me with this please.



Bob Phillips

You need conditional formatting.

Select the cell to format, and let's assume that the compare cell is A1
Menu FormatConditional Formatting
Change Condition1 to Formula Is
Add a formula of =AND(A1<TODAY(),B1="")
Click Format
Choose the text colour
OK
OK

--
HTH

Bob Phillips

"cebubum" wrote in message
...
I want to compare a date in a cell to the current date. If the current

date
is past the date in the specified cell, and the adjacent cell is blank, I
want the specified date to display in red. Would someone be so kind as to
assist me with this please.





R.VENKATARAMAN

the dates are in A1 to A20
in D1 enter
=today()

then try this sub

Public Sub test()
Dim cell As Range
For Each cell In Range("a1:a20")

If cell < Range("d1") Then
If cell.Offset(0, 1) = "" Then
cell.Font.ColorIndex = 3
Else

End If

End If
Next

End Sub


cutomise the sub to suit you.

each day the color may change.
========================
cebubum wrote in message
...
I want to compare a date in a cell to the current date. If the current

date
is past the date in the specified cell, and the adjacent cell is blank, I
want the specified date to display in red. Would someone be so kind as to
assist me with this please.





cebubum

Thank you for responding. I think I can make this work now

"Bob Phillips" wrote:

You need conditional formatting.

Select the cell to format, and let's assume that the compare cell is A1
Menu FormatConditional Formatting
Change Condition1 to Formula Is
Add a formula of =AND(A1<TODAY(),B1="")
Click Format
Choose the text colour
OK
OK

--
HTH

Bob Phillips

"cebubum" wrote in message
...
I want to compare a date in a cell to the current date. If the current

date
is past the date in the specified cell, and the adjacent cell is blank, I
want the specified date to display in red. Would someone be so kind as to
assist me with this please.






cebubum

Thanks a lot. Worked well

"R.VENKATARAMAN" wrote:

the dates are in A1 to A20
in D1 enter
=today()

then try this sub

Public Sub test()
Dim cell As Range
For Each cell In Range("a1:a20")

If cell < Range("d1") Then
If cell.Offset(0, 1) = "" Then
cell.Font.ColorIndex = 3
Else

End If

End If
Next

End Sub


cutomise the sub to suit you.

each day the color may change.
========================
cebubum wrote in message
...
I want to compare a date in a cell to the current date. If the current

date
is past the date in the specified cell, and the adjacent cell is blank, I
want the specified date to display in red. Would someone be so kind as to
assist me with this please.







All times are GMT +1. The time now is 05:12 PM.

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