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

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
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,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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