Conditional formatting of date

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top