Hi all,
I would like to sum up certain cells depending on the background colour they have. On the attachment you will find an example where values need to be summed up according to the background colour. I found the following macro online which enables me to do that. However every time I want to add a values in the range of F9 to F30 and change the background colour the sums do not update automatically.
Attachment 168438
Function SumColor(Color As Range, Range As Range) As Long
Dim Cell As Range
Dim ColorIndexNumber As Integer
Dim ColorSum
ColorIndexNumber = Color.Interior.ColorIndex
For Each Cell In Range
If Cell.Interior.ColorIndex = ColorIndexNumber Then
ColorSum = WorksheetFunction.Sum(Cell.Value) + ColorSum
End If
Next Cell
SumColor = ColorSum
End Function
I would appreciate your help as I am stuck and cant continue.
I am looking forward to hearing from you.
Bookmarks