Count Conditional Formatting

  • Thread starter Thread starter LD
  • Start date Start date
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.
 
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.
 
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.
 
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.
 
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
 
Back
Top