Conditional formatting rule for remaining cells

288enzo

Well-known Member
Joined
Feb 8, 2009
Messages
727
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

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
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,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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