how to format a row based on a cell's contents

rbachellor

New Member
Joined
Jan 20, 2011
Messages
5
I am writing a macro that colors the entire row based on one cell's contents in that row.

It works when I match the entire cell contents using indirect

Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=INDIRECT(""C""&ROW())=""[Ready to run] """
Selection.FormatConditions(1).Interior.ColorIndex = 4

Is there a way to modify this using InStr or something like that to test if the cell contains the word "Ready" and still get the same results?

Thanks
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Example code...
Code:
If InStr(1, ActiveCell.Value, "Ready", vbTextCompare) > 0 Then
   [COLOR="Green"] ' ActiveCell contains the word "ready" (not case sensitive)[/COLOR]
    ActiveCell.EntireRow.Interior.ColorIndex = 4
Else
   [COLOR="Green"] ' ActiveCell doesn't contain the word "ready"[/COLOR]
    ActiveCell.EntireRow.Interior.ColorIndex = 0
End If
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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