Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default How do I determine if conditional formatting is applied to an exc.

How do I determine if conditional formatting is applied to a spreadsheet cell
in Excel. I tried the Font Object and the Interior object, but they both
apply to normal conditions.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 634
Default How do I determine if conditional formatting is applied to an exc.

Start with this kind of logic. If the count is 0 then no CF

Sub CondCount()
fcnt = Selection.FormatConditions.Count
MsgBox fcnt
End Sub

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------

"MarkTheNuke" wrote in message
...
How do I determine if conditional formatting is applied to a spreadsheet

cell
in Excel. I tried the Font Object and the Interior object, but they both
apply to normal conditions.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default How do I determine if conditional formatting is applied to an

This tells if there is a condition, but unless I read Mark's original post
wrong I think he wants to know if the format is applied; i.e. active. That
turns out to be a difficult issue! There is no property that tells you
quickly if a format condition is met or no, at least none I know of. The
best we have is the formula in FormatConditions(n).Formula1. But that is a
string and would need to be processed to turn it into VBA code to evaluate -
yikes. So then I thought, why not temporarily put the formula from the
conditional formatting into the cell formula and use the worksheet
calculations to test the result (I would store the original cell formula and
then paste it back in the cell when done). I found first that the formula
text when read is applied to the ACTIVE cell, even though you are reading the
property for a specified cell - so relative references will be a problem
unless you first activate the cell you want to test. I could get the test to
work, but ran into one problem: if the conditional format is self-referential
(i.e. if it looks at the cell it is being applied to) I end up with a
circular reference when I replace the cell formula with the conditional
formula. I don't know any easy solution to this - the best I can think is to
parse that conditional formula but that would be an incredibly difficult
task...

Anyone know any way around this?

"Ken Wright" wrote:

Start with this kind of logic. If the count is 0 then no CF

Sub CondCount()
fcnt = Selection.FormatConditions.Count
MsgBox fcnt
End Sub

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------

"MarkTheNuke" wrote in message
...
How do I determine if conditional formatting is applied to a spreadsheet

cell
in Excel. I tried the Font Object and the Interior object, but they both
apply to normal conditions.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default How do I determine if conditional formatting is applied to an

Chip Pearson shows a way:

http://cpearson.com/excel/CFColors.htm

K Dales wrote:

This tells if there is a condition, but unless I read Mark's original post
wrong I think he wants to know if the format is applied; i.e. active. That
turns out to be a difficult issue! There is no property that tells you
quickly if a format condition is met or no, at least none I know of. The
best we have is the formula in FormatConditions(n).Formula1. But that is a
string and would need to be processed to turn it into VBA code to evaluate -
yikes. So then I thought, why not temporarily put the formula from the
conditional formatting into the cell formula and use the worksheet
calculations to test the result (I would store the original cell formula and
then paste it back in the cell when done). I found first that the formula
text when read is applied to the ACTIVE cell, even though you are reading the
property for a specified cell - so relative references will be a problem
unless you first activate the cell you want to test. I could get the test to
work, but ran into one problem: if the conditional format is self-referential
(i.e. if it looks at the cell it is being applied to) I end up with a
circular reference when I replace the cell formula with the conditional
formula. I don't know any easy solution to this - the best I can think is to
parse that conditional formula but that would be an incredibly difficult
task...

Anyone know any way around this?

"Ken Wright" wrote:

Start with this kind of logic. If the count is 0 then no CF

Sub CondCount()
fcnt = Selection.FormatConditions.Count
MsgBox fcnt
End Sub

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------

"MarkTheNuke" wrote in message
...
How do I determine if conditional formatting is applied to a spreadsheet

cell
in Excel. I tried the Font Object and the Interior object, but they both
apply to normal conditions.





--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default How do I determine if conditional formatting is applied to an

Thanks - helpful, but still has a limitation (conditions must use absolute
cell references). Still would like to find a way that does not place any
limitation on the type of condition allowed.

"Dave Peterson" wrote:

Chip Pearson shows a way:

http://cpearson.com/excel/CFColors.htm

K Dales wrote:

This tells if there is a condition, but unless I read Mark's original post
wrong I think he wants to know if the format is applied; i.e. active. That
turns out to be a difficult issue! There is no property that tells you
quickly if a format condition is met or no, at least none I know of. The
best we have is the formula in FormatConditions(n).Formula1. But that is a
string and would need to be processed to turn it into VBA code to evaluate -
yikes. So then I thought, why not temporarily put the formula from the
conditional formatting into the cell formula and use the worksheet
calculations to test the result (I would store the original cell formula and
then paste it back in the cell when done). I found first that the formula
text when read is applied to the ACTIVE cell, even though you are reading the
property for a specified cell - so relative references will be a problem
unless you first activate the cell you want to test. I could get the test to
work, but ran into one problem: if the conditional format is self-referential
(i.e. if it looks at the cell it is being applied to) I end up with a
circular reference when I replace the cell formula with the conditional
formula. I don't know any easy solution to this - the best I can think is to
parse that conditional formula but that would be an incredibly difficult
task...

Anyone know any way around this?

"Ken Wright" wrote:

Start with this kind of logic. If the count is 0 then no CF

Sub CondCount()
fcnt = Selection.FormatConditions.Count
MsgBox fcnt
End Sub

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------

"MarkTheNuke" wrote in message
...
How do I determine if conditional formatting is applied to a spreadsheet
cell
in Excel. I tried the Font Object and the Interior object, but they both
apply to normal conditions.




--

Dave Peterson



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default How do I determine if conditional formatting is applied to an

There is another problem with the solution at
http://cpearson.com/excel/CFColors.htm
There is an undefined function in the demo code.
GetStrippedValue(cellReference as Range)
Makes it really hard to try out a 'solution' if something is missing. Plus
it looks like the GetStrippedValue might be a formidable function.

"K Dales" wrote:

Thanks - helpful, but still has a limitation (conditions must use absolute
cell references). Still would like to find a way that does not place any
limitation on the type of condition allowed.

"Dave Peterson" wrote:

Chip Pearson shows a way:

http://cpearson.com/excel/CFColors.htm

K Dales wrote:

This tells if there is a condition, but unless I read Mark's original post
wrong I think he wants to know if the format is applied; i.e. active. That
turns out to be a difficult issue! There is no property that tells you
quickly if a format condition is met or no, at least none I know of. The
best we have is the formula in FormatConditions(n).Formula1. But that is a
string and would need to be processed to turn it into VBA code to evaluate -
yikes. So then I thought, why not temporarily put the formula from the
conditional formatting into the cell formula and use the worksheet
calculations to test the result (I would store the original cell formula and
then paste it back in the cell when done). I found first that the formula
text when read is applied to the ACTIVE cell, even though you are reading the
property for a specified cell - so relative references will be a problem
unless you first activate the cell you want to test. I could get the test to
work, but ran into one problem: if the conditional format is self-referential
(i.e. if it looks at the cell it is being applied to) I end up with a
circular reference when I replace the cell formula with the conditional
formula. I don't know any easy solution to this - the best I can think is to
parse that conditional formula but that would be an incredibly difficult
task...

Anyone know any way around this?

"Ken Wright" wrote:

Start with this kind of logic. If the count is 0 then no CF

Sub CondCount()
fcnt = Selection.FormatConditions.Count
MsgBox fcnt
End Sub

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------

"MarkTheNuke" wrote in message
...
How do I determine if conditional formatting is applied to a spreadsheet
cell
in Excel. I tried the Font Object and the Interior object, but they both
apply to normal conditions.




--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Conditional Formatting Applied when Statement Not True Deanna Excel Discussion (Misc queries) 7 September 23rd 09 04:14 PM
In Excel, can Boolean logic be applied to conditional formatting? PeterL Excel Worksheet Functions 3 October 26th 06 08:16 PM
can conditional formatting be applied in more then three instance Mary jane New Users to Excel 2 December 21st 05 04:02 AM
Conditional Formatting not applied to data exported from Access Mark A Excel Worksheet Functions 5 October 24th 05 12:11 PM
counting cells with conditional formatting applied HalB Excel Discussion (Misc queries) 3 February 21st 05 01:21 PM


All times are GMT +1. The time now is 11:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"