VBA to highlight row with red text

thelad

Board Regular
Joined
Jan 28, 2011
Messages
245
Hi,

I have rows of data and I would like to highlight every row of data that has 0 in column c with red text and Calibri 8.

For every other row that doesn't have 0 in column C it should be blue text and Calibri 8 down to last used row.

Data will start from row 2. Headings in row 1 I dont want touched.

Anyone know how to achieve this? Presume it needs some sort of testing loop?

Regards,
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Give this macro a try...
Code:
[table="width: 500"]
[tr]
	[td]Sub MakeZerosRed()
  Application.ReplaceFormat.Clear
  With Range("C2", Cells(Rows.Count, "C").End(xlUp))
    Application.ReplaceFormat.Font.Name = "Calibri"
    Application.ReplaceFormat.Font.Size = 8
    .Replace "*", "", xlWhole, SearchFormat:=False, ReplaceFormat:=True
    Application.ReplaceFormat.Font.Color = vbRed
    .Replace 0, "", xlWhole, SearchFormat:=False, ReplaceFormat:=True
    Application.ReplaceFormat.Clear
  End With
End Sub[/td]
[/tr]
[/table]
 
Upvote 0
Hi,

It marked the zero in column C as red but I want to highlight the whole row in red text. Can this be done?

And then for rows that don't have zero in column C I would like blue color text?
 
Upvote 0
HI Rick, Any luck with the above? Your solution does put the "0" in red text but I need the entire row in red text
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,329
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