Selecting Row based on a Cell Value

ERed1

Board Regular
Joined
Jun 26, 2019
Messages
104
Hi all,

I have data that is always changing. I need a macro that searches through column AH for the word "Black". If the word "Black" is found then that row gets selected and the font gets changed to red. I have to code for the red font, I just cant figure out how to select the specific row.

Here is the code for the red font:
Code:
With Selection.Font
.Color = -16776961
.TintAndShade = 0
End With

Thank you in advance!
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Why not use conditional formatting, rather than a macro?
Also do you want the font for the entire row to be red, or just that cell?
 
Upvote 0
I didn't even think about that. I would I set up the rule for it? I haven't used conditional formatting before.
 
Upvote 0
Depends on the answer to my 2nd question ;)
 
Upvote 0
For the whole row, or just the cell in col AH?
 
Upvote 0
The whole row should have red font, if the cell in AH has "Black" as a cell value.
 
Upvote 0
Ok, select your data & then in Conditional Formating > New rule > Use a formula & enter
=$AH2="Black"
Then select the format & Ok.
This assumes that the first row you selected is row 2, if not change $AH2 to match the first selected row.
 
Upvote 0
Ok, select your data & then in Conditional Formating > New rule > Use a formula & enter
=$AH2="Black"
Then select the format & Ok.
This assumes that the first row you selected is row 2, if not change $AH2 to match the first selected row.
This worked perfectly. Thank you.
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,206
Members
452,618
Latest member
Tam84

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