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!
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
33,909
Office Version
365
Platform
Windows
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?
 

ERed1

Board Regular
Joined
Jun 26, 2019
Messages
104
I didn't even think about that. I would I set up the rule for it? I haven't used conditional formatting before.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
33,909
Office Version
365
Platform
Windows
Depends on the answer to my 2nd question ;)
 

ERed1

Board Regular
Joined
Jun 26, 2019
Messages
104
Haha didn't see that. I would like just the font to be red if possible.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
33,909
Office Version
365
Platform
Windows
For the whole row, or just the cell in col AH?
 

ERed1

Board Regular
Joined
Jun 26, 2019
Messages
104
The whole row should have red font, if the cell in AH has "Black" as a cell value.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
33,909
Office Version
365
Platform
Windows
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.
 

ERed1

Board Regular
Joined
Jun 26, 2019
Messages
104
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.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
33,909
Office Version
365
Platform
Windows
You're welcome & thanks for the feedback
 

Forum statistics

Threads
1,086,021
Messages
5,387,271
Members
402,054
Latest member
JHENGNDK

Some videos you may like

This Week's Hot Topics

Top