Highlight row based on cell value

Babio1964

New Member
Joined
May 12, 2015
Messages
8
hi,
I was kinda surprised I couldn't find a solution when I Googled this...
Let's say I have columns A through M. In Column C, I have various string values (let's say animals). Now, I want to highlight only those columns A through M when the value in column C is "Dog". I know I can do a For Each - EntireRow.Interior.Color thing, but I always think that looks scrappy when all the columns are highlighted even when they contain no data. For the record, columns A through M is static and will never change (ie There will never be a column N)

I appreciate the help!
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Select your data, for instance A2:M100, on the home tab, Conditional Format, New Rule, Use a Formula
=$C2="Dog"
Select the format you want, Ok
 
Upvote 0
thank you. Sorry, I should have added, I'd like to do this with VBA. Kinda involved, but the data I'm using comes from an outside source and ends up in multiple worksheets...
 
Upvote 0
Ok, how about
Code:
Sub Babio()
   Dim UsdRws As Long
   With ActiveSheet
      UsdRws = .Range("C" & Rows.Count).End(xlUp).Row
      .Range("A1:M" & UsdRws).AutoFilter 3, "Dog"
      .AutoFilter.Range.Offset(1).Resize(UsdRws - 1).Interior.Color = 45678
      .AutoFilterMode = False
   End With
End Sub
 
Upvote 0
Ok, how about
Code:
Sub Babio()
   Dim UsdRws As Long
   With ActiveSheet
      UsdRws = .Range("C" & Rows.Count).End(xlUp).Row
      .Range("A1:M" & UsdRws).AutoFilter 3, "Dog"
      .AutoFilter.Range.Offset(1).Resize(UsdRws - 1).Interior.Color = 45678
      .AutoFilterMode = False
   End With
End Sub

Oh my!
You're wonderful. Worked perfectly
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,190
Members
452,616
Latest member
intern444

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