J
Jim Thomlinson
Before I explain the situation the question is
"What causes a conditional format to be evaluated?"
A few threads down from here I answered a question about having a
conditional format based on the absence (or presence) of a comment in the
cell. I realized shortly after posting my initial response that it would not
work. (Adding a column populated with a UDF that returned true or false based
on a cell having a comment.) The UDF would not calculate because the addition
of a comment would not initiate a calculation to update the UDF (even with
application.volatile added). I didn't think it would work but I added the UDF
directly to the conditional format and I will be darned... but it actually
works (much to my surprise). The addition of a comment causes the formula in
the conditional format to be evaluated. Here is the code...
Public Function HasComment(ByVal Cell As Range) As Boolean
If Cell.Comment Is Nothing Then
HasComment = False
Else
HasComment = True
End If
End Function
In Cell A1 add to the conditional format the formula =HasComment(A1)
Now if you add or remove a comment the formatting changes. No events fire
(selection change, calculate, change). So out of pure curiosity why does this
work? What is causing the formula in the conditional format to be
re-evaluated?
"What causes a conditional format to be evaluated?"
A few threads down from here I answered a question about having a
conditional format based on the absence (or presence) of a comment in the
cell. I realized shortly after posting my initial response that it would not
work. (Adding a column populated with a UDF that returned true or false based
on a cell having a comment.) The UDF would not calculate because the addition
of a comment would not initiate a calculation to update the UDF (even with
application.volatile added). I didn't think it would work but I added the UDF
directly to the conditional format and I will be darned... but it actually
works (much to my surprise). The addition of a comment causes the formula in
the conditional format to be evaluated. Here is the code...
Public Function HasComment(ByVal Cell As Range) As Boolean
If Cell.Comment Is Nothing Then
HasComment = False
Else
HasComment = True
End If
End Function
In Cell A1 add to the conditional format the formula =HasComment(A1)
Now if you add or remove a comment the formatting changes. No events fire
(selection change, calculate, change). So out of pure curiosity why does this
work? What is causing the formula in the conditional format to be
re-evaluated?