Conditional Formatting in Multiple Columns

dbuzo

New Member
Joined
Sep 29, 2014
Messages
10
Good morning,
I want to highlight an entire row if specific text is entered in a cell. For example, each row has data for employees. Column B has the role of the employee (primary, secondary, supervisor). If "primary" is in column B then I want the entire row highlighted (or at least their name) to be formatted as well. Is this possible?
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

ChrisBM

Board Regular
Joined
Sep 22, 2014
Messages
215
Code:
'Put in start and end rows for 1 and 100
For i = 1 to 100
       If Range("B" & i).Value = "primary" Then
             Rows(i & ":" & i).Select
                            'Highlight row
                            With Selection.Interior                   
                                             .Pattern = xlSolid
                                             .PatternColorIndex = xlAutomatic
                                             .ThemeColor = xlThemeColorDark2
                                             .TintAndShade = -0.249977111117893
                                             .PatternTintAndShade = 0
                         End With
        End If
Next
 

Special-K99

Well-known Member
Joined
Nov 7, 2006
Messages
8,425
Office Version
  1. 2019
Select B1

Conditional Formatting
New Rule
Use a formula to determine...

=($B1="primary")

format as required
Use Format painter (paintbrush icon) to copy to other cells
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,016
Messages
5,834,948
Members
430,330
Latest member
drAli77

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
Top