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!
 

Some videos you may like

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
35,764
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
35,764
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
35,764
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
35,764
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
35,764
Office Version
365
Platform
Windows
You're welcome & thanks for the feedback
 

Watch MrExcel Video

Forum statistics

Threads
1,089,761
Messages
5,410,271
Members
403,305
Latest member
tray2014

This Week's Hot Topics

Top