ExcelBanter

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

gocats

Count conditional formatting
 
Part A) If only 1 cell in a range does has ColorIndex = 0, how can I then set
its interior color to something else?

Part B) If only cell in a relative postion in a multiple range has
ColorIndex = 0, how can I then set its interior color to something else?



Tom Ogilvy

Count conditional formatting
 
ActiveCell.Interior.ColorIndex = 21

ActiveCell.Offset(0,3).Interior.colorIndex = 21

If you want a uniform color index

Selection.Interior.ColorIndex = 21

--
Regards,
Tom Ogilvy


"gocats" wrote in message
...
Part A) If only 1 cell in a range does has ColorIndex = 0, how can I then

set
its interior color to something else?

Part B) If only cell in a relative postion in a multiple range has
ColorIndex = 0, how can I then set its interior color to something else?





Tom Ogilvy

Count conditional formatting
 
Your subject says count conditional formatting, but your question doesn't
seem to pertain to conditional formatting. Perhaps you could restate your
question to give a clearer indication of what you are trying to do and what
the actual conditions are.

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
ActiveCell.Interior.ColorIndex = 21

ActiveCell.Offset(0,3).Interior.colorIndex = 21

If you want a uniform color index

Selection.Interior.ColorIndex = 21

--
Regards,
Tom Ogilvy


"gocats" wrote in message
...
Part A) If only 1 cell in a range does has ColorIndex = 0, how can I

then
set
its interior color to something else?

Part B) If only cell in a relative postion in a multiple range has
ColorIndex = 0, how can I then set its interior color to something else?







gocats

count Interior.colorIndex
 
Thanks Tom, but I dont' think you have not quite understood my problem.

All cells in a range (and qroup of ranges) are subject to conditional
formatting. However, if only one cell has Interior.colorIndex = 0, I then
want that one cell to have Interior.colorIndex = 1.

In addition the second part is, if only one cell in a relative postion in
multiple ranges has Interior.colorIndex = 0, then I want that one cell to
have Interior.colorIndex = 1.

"Tom Ogilvy" wrote:

Your subject says count conditional formatting, but your question doesn't
seem to pertain to conditional formatting. Perhaps you could restate your
question to give a clearer indication of what you are trying to do and what
the actual conditions are.

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
ActiveCell.Interior.ColorIndex = 21

ActiveCell.Offset(0,3).Interior.colorIndex = 21

If you want a uniform color index

Selection.Interior.ColorIndex = 21

--
Regards,
Tom Ogilvy


"gocats" wrote in message
...
Part A) If only 1 cell in a range does has ColorIndex = 0, how can I

then
set
its interior color to something else?

Part B) If only cell in a relative postion in a multiple range has
ColorIndex = 0, how can I then set its interior color to something else?








Tom Ogilvy

count Interior.colorIndex
 
conditional formatting colors can not be directly determined using VBA. You
would have to test the underlying condition that would cause the color to
change. So you would have to loop through you range and determine how many
cells in the range meet the condition to be other than coloridex 0 and that
one only is actually colorindex 0. then you would have to remove
conditional formatting from that cell or change the colorindex for the
conditional formatting.

--
Regards,
Tom Ogivy

"gocats" wrote in message
...
Thanks Tom, but I dont' think you have not quite understood my problem.

All cells in a range (and qroup of ranges) are subject to conditional
formatting. However, if only one cell has Interior.colorIndex = 0, I

then
want that one cell to have Interior.colorIndex = 1.

In addition the second part is, if only one cell in a relative postion in
multiple ranges has Interior.colorIndex = 0, then I want that one cell

to
have Interior.colorIndex = 1.

"Tom Ogilvy" wrote:

Your subject says count conditional formatting, but your question

doesn't
seem to pertain to conditional formatting. Perhaps you could restate

your
question to give a clearer indication of what you are trying to do and

what
the actual conditions are.

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
ActiveCell.Interior.ColorIndex = 21

ActiveCell.Offset(0,3).Interior.colorIndex = 21

If you want a uniform color index

Selection.Interior.ColorIndex = 21

--
Regards,
Tom Ogilvy


"gocats" wrote in message
...
Part A) If only 1 cell in a range does has ColorIndex = 0, how can I

then
set
its interior color to something else?

Part B) If only cell in a relative postion in a multiple range has
ColorIndex = 0, how can I then set its interior color to something

else?










gocats

count Interior.colorIndex
 
Thanks Tom.

It looks like I will have to try something else.

"Tom Ogilvy" wrote:

conditional formatting colors can not be directly determined using VBA. You
would have to test the underlying condition that would cause the color to
change. So you would have to loop through you range and determine how many
cells in the range meet the condition to be other than coloridex 0 and that
one only is actually colorindex 0. then you would have to remove
conditional formatting from that cell or change the colorindex for the
conditional formatting.

--
Regards,
Tom Ogivy

"gocats" wrote in message
...
Thanks Tom, but I dont' think you have not quite understood my problem.

All cells in a range (and qroup of ranges) are subject to conditional
formatting. However, if only one cell has Interior.colorIndex = 0, I

then
want that one cell to have Interior.colorIndex = 1.

In addition the second part is, if only one cell in a relative postion in
multiple ranges has Interior.colorIndex = 0, then I want that one cell

to
have Interior.colorIndex = 1.

"Tom Ogilvy" wrote:

Your subject says count conditional formatting, but your question

doesn't
seem to pertain to conditional formatting. Perhaps you could restate

your
question to give a clearer indication of what you are trying to do and

what
the actual conditions are.

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
ActiveCell.Interior.ColorIndex = 21

ActiveCell.Offset(0,3).Interior.colorIndex = 21

If you want a uniform color index

Selection.Interior.ColorIndex = 21

--
Regards,
Tom Ogilvy


"gocats" wrote in message
...
Part A) If only 1 cell in a range does has ColorIndex = 0, how can I
then
set
its interior color to something else?

Part B) If only cell in a relative postion in a multiple range has
ColorIndex = 0, how can I then set its interior color to something

else?












All times are GMT +1. The time now is 05:19 PM.

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