View Single Post
  #3   Report Post  
Old September 24th 04, 06:59 PM posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
First recorded activity by ExcelBanter: Jan 2004
Posts: 3,885
Default Summing Cells with a BLUE font (or any other color)

Hi
where do you put this function?. It has to go in a standard module

--
Regards
Frank Kabel
Frankfurt, Germany

"RAYMOND KELLY" schrieb im Newsbeitrag
...
To all,

I am trying to sum cells that have a specific color.

Here is what I have so far:
Function SumByColor(InRange As Range, WhatColorIndex As Integer)

Dim Rng As Range
Dim OK As Boolean

Application.Volatile True
For Each Rng In InRange.Cells
OK = (Rng.Font.ColorIndex = WhatColorIndex)
If OK And IsNumeric(Rng.Value) Then
SumByColor = SumByColor + Rng.Value
End If
Next Rng

End Function
****Thank you Chip****

When I attempt to use this, I get an error "#NAME?"

Any ideas on what is going wrong?
Thanks.
--
RAYMOND KELLY