Hi Angel
I am not sure of 2007 version as I do not own one.
You can find the solution you are seeking here at Chip Pearson's great site,
Look at tha section on Operations With Color Index Values
http://www.cpearson.com/excel/colors.aspx
The SumColor function's code is reproduced here
Function SumColor(TestRange As Range, SumRange As Range, _
ColorIndex As Long, Optional OfText As Boolean = False) As Variant
Dim D As Double
Dim N As Long
Dim CI As Long
Application.Volatile True
If (TestRange.Areas.Count 1) Or _
(SumRange.Areas.Count 1) Or _
(TestRange.Rows.Count < SumRange.Rows.Count) Or _
(TestRange.Columns.Count < SumRange.Columns.Count) Then
SumColor = CVErr(xlErrRef)
Exit Function
End If
If ColorIndex = 0 Then
If OfText = False Then
CI = xlColorIndexNone
Else
CI = xlColorIndexAutomatic
End If
Else
CI = ColorIndex
End If
Select Case CI
Case 0, xlColorIndexAutomatic, xlColorIndexNone
' ok
Case Else
If IsValidColorIndex(ColorIndex:=ColorIndex) = False Then
SumColor = CVErr(xlErrValue)
Exit Function
End If
End Select
For N = 1 To TestRange.Cells.Count
With TestRange.Cells(N)
If OfText = True Then
If .Font.ColorIndex = CI Then
If IsNumeric(.Value) = True Then
D = D + .Value
End If
End If
Else
If .Interior.ColorIndex = CI Then
If IsNumeric(.Value) = True Then
D = D + .Value
End If
End If
End If
End With
Next N
SumColor = D
End Function
--
Hope this is helpful
Pls click the Yes button below if this post provide answer you have asked
Thank You
cheers, francis
"angelico" wrote:
Can I sum a column based on the colors of the cells. Thua add all red, all
gree, etc.
--
angelico