I'm using the following code which I know works...but for some reason it's NOT working in my spreadsheet. It's adding the entire column regardless of the color I've specified in the range cell. Any thoughts?
Function SumColor(rColor As Range, rSumRange As Range)
'Written by Ozgrid Business Applications
'www.ozgrid.com
Dim rCell As Range
Dim iCol As Integer
Dim vResult
iCol = rColor.Interior.ColorIndex
For Each rCell In rSumRange
If rCell.Interior.ColorIndex = iCol Then
vResult = WorksheetFunction.Sum(rCell) + vResult
End If
Next rCell
SumColor = vResult
End Function
Function SumColor(rColor As Range, rSumRange As Range)
'Written by Ozgrid Business Applications
'www.ozgrid.com
Dim rCell As Range
Dim iCol As Integer
Dim vResult
iCol = rColor.Interior.ColorIndex
For Each rCell In rSumRange
If rCell.Interior.ColorIndex = iCol Then
vResult = WorksheetFunction.Sum(rCell) + vResult
End If
Next rCell
SumColor = vResult
End Function