Conditional formatting rule for remaining cells

288enzo

Well-known Member
Joined
Feb 8, 2009
Messages
721
Office Version
  1. 2016
Platform
  1. Windows
Hi all,

I'm curious to know if it's possible to create a conditional formatting rule that would be applied only if a particular cell didn't have a rule already applied?

As an example, I have a range that I'm applying two separate rules.

What I'm currently working with:
VBA Code:
    With Range("P2:P" & lr1)
        .FormatConditions.Add Type:=xlTextString, String:="Registered", TextOperator:=xlContains
            With .FormatConditions(.FormatConditions.Count)
                 .Font.Bold = True
                 .Interior.Color = RGB(0, 153, 76)
                 .Font.Color = RGB(255, 255, 255)
                 .StopIfTrue = False
            End With
        .FormatConditions.Add Type:=xlTextString, String:="Expired", TextOperator:=xlContains
            With .FormatConditions(.FormatConditions.Count)
                .Font.Bold = True
                .Interior.Color = RGB(192, 0, 0)
                .Font.Color = RGB(255, 255, 255)
                .StopIfTrue = False
            End With
    End With
I'd like to add a third rule for all cells in the range that haven't had a rule applied to be:
VBA Code:
            With .FormatConditions(.FormatConditions.Count)
                .Font.Bold = True
                .Interior.Color = RGB(255, 255, 0)
                .Font.Color = RGB(0, 0, 0)
                .StopIfTrue = False
            End With
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Okay, so all my remaining cells would show a day, and those are what I'd like to format. Hopefully that makes it a bit easier. I've tried "Type:=xlTimePeriod" options, but there isn't one specific to my needs. Basically, date shown greater than Today would be formatted. The issue I'm having is those cells that show Registered are also formatted when I use something like >Today().
Cell Formulas
RangeFormula
P7576:P7579P7576=IF(LEFT(N7576,1)="Y","Registered",IF(N7576<>"","",IF(M7576+10<TODAY(),"Expired",M7576+10)))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
P2:P13671Cell Valuecontains "Expired"textNO
P2:P13671Cell Valuecontains "Registered"textNO
 
Upvote 0

Forum statistics

Threads
1,214,950
Messages
6,122,436
Members
449,083
Latest member
Ava19

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