Conditional formatting of date

C

cebubum

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.
 
B

Bob Phillips

You need conditional formatting.

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

cebubum

Thanks a lot. Worked well

R.VENKATARAMAN said:
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.
========================
 
Top