If any cell in named range = 8 then shade named range

J

JJ

How would I do this please?

If any one of the cells in the range("Block_Three") = 8 then shade the
range("Block_Three") yellow.
 
T

Tom Ogilvy

if application.countif(Range("Block_Three"),8) > 0 then
Range("Block_Three").Interior.ColorIndex = 6
End if


or if only exactly 1
if application.countif(Range("Block_Three"),8) = 1 then
Range("Block_Three").Interior.ColorIndex = 6
End if
 
D

Doug Glancy

JJ,

Use Format --> Conditional Formatting in Excel. Highlight Block_Three and
enter this formula in the dialog:

=COUNTIF(Block_Three,8)

Then choose yellow as the format.

hth,

Doug
 
J

JJ

Fantastic Tom, thank you.


Tom Ogilvy said:
if application.countif(Range("Block_Three"),8) > 0 then
Range("Block_Three").Interior.ColorIndex = 6
End if


or if only exactly 1
if application.countif(Range("Block_Three"),8) = 1 then
Range("Block_Three").Interior.ColorIndex = 6
End if
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top