ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   If any cell in named range = 8 then shade named range (https://www.excelbanter.com/excel-programming/338488-if-any-cell-named-range-%3D-8-then-shade-named-range.html)

JJ[_8_]

If any cell in named range = 8 then shade named range
 
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.




Tom Ogilvy

If any cell in named range = 8 then shade named range
 
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

--
Regards,
Tom Ogilvy



"JJ" wrote in message
...
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.






Doug Glancy

If any cell in named range = 8 then shade named range
 
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

"JJ" wrote in message
...
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.






JJ[_8_]

If any cell in named range = 8 then shade named range
 
Fantastic Tom, thank you.


"Tom Ogilvy" wrote in message
...
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

--
Regards,
Tom Ogilvy



"JJ" wrote in message
...
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.









All times are GMT +1. The time now is 07:38 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com