ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Count Conditional Formatting (https://www.excelbanter.com/excel-programming/279486-count-conditional-formatting.html)

LD[_2_]

Count Conditional Formatting
 
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.



GB[_3_]

Count Conditional Formatting
 
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.

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





Pete McCosh[_5_]

Count Conditional Formatting
 
This is true. however conditional formatting does not
change the underlying cell formats, so you wont be able to
test it this way.

As is so often the case, Chip Pearson has some potentially
useful thoughts on the subject:
http://www.cpearson.com/excel/CFColors.htm

Pete.
-----Original Message-----
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.

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


David McRitchie[_2_]

Count Conditional Formatting
 
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.
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm




Tom Ogilvy

Count Conditional Formatting
 
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.

--
Regards,
Tom Ogilvy

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





GB[_3_]

Count Conditional Formatting
 

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.

--
Regards,
Tom Ogilvy


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

GB






All times are GMT +1. The time now is 12:13 PM.

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