Colour cells of specific value?

R

rj

Hi all,

I want a macro that checks through the current worksheet and colours
every cell that has a specified value.. Eg. if F12 has "BAD" typed in
it, then F12 should be coloured red..

thanks in advance..
 
M

Mike

You don't need a macro simply use conditional formatting. select all the
cells on the worksheet and set up the conditional format to be red if the
cell contents match your criteria.

Mike
 
R

rj

thanx, that would work, but i need it as part of a macro so the changes
take place (and other changes as well) when i click a button..
 
B

Bob Phillips

With Range("F12")
If .Value = "BAD" Then
.Interior.Colorindex = 3
Else
.Interior.Colorindex = xlColorindexNone
End If
End With


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
Top