ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   the value of a condition in a conditional format (https://www.excelbanter.com/excel-programming/403917-value-condition-conditional-format.html)

[email protected]

the value of a condition in a conditional format
 
I use a conditional format to change the interior colour of cells. the
conditional is the same for all the cells to which the conditional
format refers. I'd like to know the displayed colour of a cell to
which the conditional format is applied, from VBA code. the
"background" colour of the cell is available as
<cell.interior.colorindex
the conditional format color is available as
<cell.<conditionalformat(1).interior.colorinde x
but the displayed colour depends on whether
<cell.<conditionalformat(1).formula1
is true or false.

I'd rather not have to write an interpreter for what could be a
general expression.

thanks,
Eric

Bob Phillips

the value of a condition in a conditional format
 
Not simple, but see http://www.xldynamic.com/source/xld.CFConditions.html

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



wrote in message
...
I use a conditional format to change the interior colour of cells. the
conditional is the same for all the cells to which the conditional
format refers. I'd like to know the displayed colour of a cell to
which the conditional format is applied, from VBA code. the
"background" colour of the cell is available as
<cell.interior.colorindex
the conditional format color is available as
<cell.<conditionalformat(1).interior.colorinde x
but the displayed colour depends on whether
<cell.<conditionalformat(1).formula1
is true or false.

I'd rather not have to write an interpreter for what could be a
general expression.

thanks,
Eric




sizex

the value of a condition in a conditional format
 
Bob!

thanks. I found that I could just run through the cells selecting them

....
Cells(i, j).Select
' because I use European separators...
formatCond =
Application.Substitute(Selection.FormatConditions( 1).Formula1, ";",
",")
If Selection.Parent.Evaluate(formatCond) Then
....

to get the right relative positioning for the evaluation of formula1.

Eric

On 9 Jan, 16:17, "Bob Phillips" wrote:
Not simple, but seehttp://www.xldynamic.com/source/xld.CFConditions.html

--
---
HTH

Bob





All times are GMT +1. The time now is 06:09 PM.

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