Count Conditional Formatting

L

LD

I am using conditional formatting to display errors (Missing data) on a
sheet.
My range is just from J12 to J27.

I want to prevent printing if one or more of the cells are red.
Allready have the code.
I just need to insert a IF statement to check if there are any cells in that
range that are formatted as red.(Missing Data)

How do I count the cells that are RED as a result of Conditional Formatting?

Any help will be appretiated.
Thanx.
 
G

GB

To get the colour of the cells, you need to use the Interior property
(believe it or not!)

Also, there are different shades of Red, so you will need to be specific.
 
D

David McRitchie

Normally you would use the same formula that you used to produce
your CF colors to describe such things in your worksheet so you can
count things. Since you want it for programming you might abort
the printing if you have a count in a certain column. Since the basis
is empty cells it might be easier to just program something directly
forgetting that you've done anything for CF in worksheet formulas.
 
T

Tom Ogilvy

If the cells are empty and that is all your conditional formatting checks
for, then check them directly

Dim rng as Range
On Error Resume Next
set rng = Range("J12:J27").SpecialCells(xlBlanks)
On Error goto 0
if rng is nothing then
' there are no blanks
Else
rng.select
Msg "Please fill in missing values"
End if

If you actually need to check the conditions, then follow Peter McCosh's
advice with respect to Chip Pearsons site. Also, as he said, GB is
incorrect.
 
G

GB

If you actually need to check the conditions, then follow Peter McCosh's
advice with respect to Chip Pearsons site. Also, as he said, GB is
incorrect.

Rats! I thought I could use some of my new-found knowledge. It's obviously
spread a bit too thinly. I stand corrected.

GB
 

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