View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mark Stephens Mark Stephens is offline
external usenet poster
 
Posts: 124
Default Chip Pearson UDF returns #VALUE! error please help, just cannotfigure out why?

Hi there,

Really hope someone can help me here as I am simply stuck!

I am attempting to use Chip Pearson's code he http://www.cpearson.com/Excel/CFColors.htm

to detect the conditionally formatted color fo a cell (or to be more accurante a range of cells). I pasted all Chips code into my macro enabked wrkbook and typed in the formula and it simply does not work. I know Chip wouldn't post dysfunctional code on his site so it must be something wrong with my implementation but I am flummoxed by whay exactly, hope someone can suggest something.

To troubleshoot/debug the code I inserted a break in the code that is run when the udf is calculating and I have found the source of the problem. The code for the functionn i am using calls a sub function which runs fine until the last line he

Function ActiveCondition(Rng As Range) As Integer
Dim Ndx As Long
Dim FC As FormatCondition
Dim Temp As Variant
Dim Temp2 As Variant

If Rng.FormatConditions.Count = 0 Then
ActiveCondition = 0
Else
For Ndx = 1 To Rng.FormatConditions.Count

Set FC = Rng.FormatConditions(Ndx)

It is counting the number of conditions in the range (1) so i cannot see why it is not able to set the condition. Waht happens at this point is that the code simply stops running, no error essage, nothing it just stops, which is rather unhelpful and leaves me with no idea what to do now.

Hope someone can help as I am desperate to get it working.

Thanks in advance, Mark