Conditional format won't work for cell containing "TODAY()"

Excelerate2

New Member
Joined
Mar 18, 2022
Messages
25
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
Really simple question: I am using Excel 2010 and noticed that if I try to conditional format a cell that contains a formula "=TODAY()", that it won't highlight!
I have tried every combination but can't get it to work, even if I get it to highlight, as soon as I enter the actual date it still stays highlighted!

It's really simple: I just need one cell (I3) to highlight if it contains the formula for today's date "=TODAY()" and also if it is blank.
I am using it as a reminder for the user to enter today's date in the cell (because if they don't then the form will always show today's date and not the date created, etc)
Any help would be great, very frustrating as CF works for everything else except this simple thing.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
I don't have Excel 2010 but it sounds like you are using the "Formula" option to try to apply the conditional formatting which as you mentioned does not work.

This will not work

2022-05-08 11_44_48-Edit Formatting Rule.png

This should work to highlight today

2022-05-08 11_43_01-Window.png
 
Upvote 0
I don't have Excel 2010 but it sounds like you are using the "Formula" option to try to apply the conditional formatting which as you mentioned does not work.

This will not work

View attachment 64133
This should work to highlight today

View attachment 64134
Yes, I have tried 'highlight cell rules' and 'cells that contain' "TODAY" etc, with no luck...
 
Upvote 0
Thanks guys but I don't need it to find today's date, I just just need to highlight one cell (the 'Date' cell = I3), if it finds the formula =TODAY(), or if that same cell (I3) is BLANK.
The If Blank condition works fine, but it doesn't work when finding =TODAY() in that cell, actually it works (it highlights) but then once you type in the date (as we request they do to override the =TODAY(), then the cell still stays highlighted.

Anyway, maybe can write some vba for cell I3 instead?
 
Upvote 0
Maybe if VBA works for you

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)

If Range("I3").Formula = "=TODAY()" Or IsEmpty(Range("I3").Value) Then

    With Range("I3").Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .Color = 65535
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With
End If


If Not IsEmpty(Range("I3").Value) And Range("I3").Formula <> "=TODAY()" Then
    With Range("I3").Interior
        .Pattern = xlNone
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With
End If



End Sub
 
Upvote 0
Maybe if VBA works for you

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)

If Range("I3").Formula = "=TODAY()" Or IsEmpty(Range("I3").Value) Then

    With Range("I3").Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .Color = 65535
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With
End If


If Not IsEmpty(Range("I3").Value) And Range("I3").Formula <> "=TODAY()" Then
    With Range("I3").Interior
        .Pattern = xlNone
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With
End If



End Sub
Thanks again, would you happen to know how to fit this new code into my existing code for this tab?
I get the Ambiguous error due to already having Worksheet_Change, and when I try to paste it in without that I will get a different error
(Your code works perfectly on a blank tab though)

Here's my existing code:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Address(False, False) = "I11" Then
If IsEmpty(.Value) Then
Application.EnableEvents = False
.Formula = "=IF(AND(C11>0,C10>0),I10*C11+C10,0)"
Application.EnableEvents = True
End If
End If

If .Address(False, False) = "H119" Then
If IsEmpty(.Value) Then
Application.EnableEvents = False
.Formula = "='" & Sheet16.Name & "'!I181"
Application.EnableEvents = True
End If
End If
End With

If Intersect(Target, Range("DropMenu")) Is Nothing Then Exit Sub 'change cell address (in red) to be protected here
If Target.Value = "" Then
MsgBox "Sorry, you cannot delete," & " Please select from the dropdown menu"
With Application
.EnableEvents = False
.Undo
.EnableEvents = True
End With
End If

End Sub
 
Upvote 0
Perhaps:

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)

If Range("I3").Formula = "=TODAY()" Or IsEmpty(Range("I3").Value) Then

    With Range("I3").Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .Color = 65535
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With
End If


If Not IsEmpty(Range("I3").Value) And Range("I3").Formula <> "=TODAY()" Then
    With Range("I3").Interior
        .Pattern = xlNone
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With
End If

With Target
If .Address(False, False) = "I11" Then
If IsEmpty(.Value) Then
Application.EnableEvents = False
.Formula = "=IF(AND(C11>0,C10>0),I10*C11+C10,0)"
Application.EnableEvents = True
End If
End If

If .Address(False, False) = "H119" Then
If IsEmpty(.Value) Then
Application.EnableEvents = False
.Formula = "='" & Sheet16.Name & "'!I181"
Application.EnableEvents = True
End If
End If
End With

If Intersect(Target, Range("DropMenu")) Is Nothing Then Exit Sub 'change cell address (in red) to be protected here
If Target.Value = "" Then
MsgBox "Sorry, you cannot delete," & " Please select from the dropdown menu"
With Application
.EnableEvents = False
.Undo
.EnableEvents = True
End With
End If

End Sub
 
Upvote 0
Perhaps:

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)

If Range("I3").Formula = "=TODAY()" Or IsEmpty(Range("I3").Value) Then

    With Range("I3").Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .Color = 65535
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With
End If


If Not IsEmpty(Range("I3").Value) And Range("I3").Formula <> "=TODAY()" Then
    With Range("I3").Interior
        .Pattern = xlNone
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With
End If

With Target
If .Address(False, False) = "I11" Then
If IsEmpty(.Value) Then
Application.EnableEvents = False
.Formula = "=IF(AND(C11>0,C10>0),I10*C11+C10,0)"
Application.EnableEvents = True
End If
End If

If .Address(False, False) = "H119" Then
If IsEmpty(.Value) Then
Application.EnableEvents = False
.Formula = "='" & Sheet16.Name & "'!I181"
Application.EnableEvents = True
End If
End If
End With

If Intersect(Target, Range("DropMenu")) Is Nothing Then Exit Sub 'change cell address (in red) to be protected here
If Target.Value = "" Then
MsgBox "Sorry, you cannot delete," & " Please select from the dropdown menu"
With Application
.EnableEvents = False
.Undo
.EnableEvents = True
End With
End If

End Sub
Hello, yes I tried inserting it that way but I get an error 1004 and the code will show a highlighted error at the .Pattern = xlSolid
(Thx, sorry for the trouble)
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,935
Members
449,094
Latest member
teemeren

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top