I'm trying to count the number of cells based on colors, currently using a VBA code that already does it. But it doesnt update automatically and I will have to manually keep refreshing it. Any way to fix this?
Thank you!!
Current VBA code:
Function CountCellColor(CountRange As Range, CountColor As Range)
Dim Color As Integer
Dim Total As Integer
Color = CountColor.Interior.ColorIndex
Set rCell = CountRange
For Each rCell In CountRange
If rCell.Interior.ColorIndex = Color Then
Total = Total + 1
End If
Next rCell
CountCellColor = Total
End Function