Simple conditional formatting question

Microsoft

Board Regular
Joined
Jun 16, 2016
Messages
108
Hi guys,

I would like to highlight every row/column where a specific word is found. However, I want the highlighting to stop at the end of the data.

E.g. if A1:A20 includes "Yes" or "No" I use =$A1="Yes". I want the formatting to stop at A20. How is this possible please?

Thanks in advance.
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Hello Microsoft,

I played with the recorder and came up with this:

Try

Code:
Sub format()
 
    Dim lr As Long
    
    lr = Cells(Rows.Count, 1).End(xlUp).Row 'counts rows used in column A 
    
    Range("A1:A" & lr).Select 'select range A1 to last used cel in column A 
    Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=""d"""  'put here your specific word
    Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
    
    With Selection.FormatConditions(1).Interior 
        .PatternColorIndex = xlAutomatic
        .Color = 255 'color is red
        .TintAndShade = 0
    End With
   
End Sub

Hope this helps you :)
 
Upvote 0
This doesn't make sense.
if A1:A20 includes "Yes" or "No" I use =$A1="Yes".

What happened to the check for "No" ?

Your formula should be =OR(A1="Yes","A1="No")
Use the format painter to copy down the column.

If A21 doesnt contain Yes ro No then the formatting wont show at A21.
 
Upvote 0

Forum statistics

Threads
1,214,632
Messages
6,120,649
Members
448,975
Latest member
sweeberry

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