Hi
Can someone help me with some VBA code, I have the following to sum cells based on background colour;
Thanks
Alex
Can someone help me with some VBA code, I have the following to sum cells based on background colour;
- Function SumByColor(CellColor As Range, rRange As Range)
- Dim cSum As Long
- Dim ColIndex As Integer
- ColIndex = CellColor.Interior.ColorIndex
- For Each cl In rRange
- If cl.Interior.ColorIndex = ColIndex Then
- cSum = WorksheetFunction.SUM(cl, cSum)
- End If
- Next cl
- SumByColor = cSum
- End Function
Thanks
Alex