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

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

Fluff

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

Forum statistics

Threads
1,089,483
Messages
5,408,530
Members
403,212
Latest member
Rvbicon

This Week's Hot Topics

  • help please
    SORRY NOT ANY GOOD AT EXCEL SO HELP WOULD BE MUCH APPRECIATED this formula is in a sheet called ignore...
  • two formulas needed
    Hello, I'll try my best to explain this: First formula needed in Sheet1 cell A2: If Sheet1 cell B2 = Sheet2 cell B2 then return a 1. If not then...
  • Dynamic Counts
    Good afternoon, we are tidying up some data & the data seems to be growing quicker than we are tidying it up! What we confirm (by reviewing it...
  • Help Excel formula eliminate duplicate values and keep only 2 identical rows.
    as picture below column A has a duplicate value. but the values are not the same as the rule. sometimes 4 rows, sometimes 10 rows or 7 or 9...
  • Macro Compile Error Sub or Function not defined
    Hello, I am trying to run macros from a validation list, all macros have been created and run perfectly on there own but I'm getting a compile...
  • Last row combined with Current Region VBA
    I'm generally happy finding the last row of data through something like Lastrow = Cells(Rows.Count, "D").End(xlUp) but I don't always receive data...
Top