Help! Colour count...why does not work?
Posted by arpan on August 24, 2001 2:45 PM
Hello can anyone help me?
How can i re-calculate the sumbycolour formula?
This function works propertly only the first time i write the formula sumbycolour(cellcolour;sumrange).
Thank you all
Function SUMBYCOLOUR(CellColour As Range, SumRange As Range)
Dim cell As Range
Dim SumColour As Integer
Dim MySum
SumColour = CellColour.Interior.ColorIndex
For Each cell In SumRange
If cell.Interior.ColorIndex = SumColour Then
MySum = 1 + MySum
End If
Next cell
SUMBYCOLOUR = MySum
End Function