Hello. I've found the following bit of code online, to add a =countccoolor function to excel, which counts the number of cells in a range that have a certain color. The range is the "A" column, and I color whole rows based on case status.

Function CountCcolor(range_data As Range, criteria As Range) As Long
    Dim datax As Range
    Dim xcolor As Long
xcolor = criteria.Interior.ColorIndex
For Each datax In range_data
    If datax.Interior.ColorIndex = xcolor Then
        CountCcolor = CountCcolor + 1

    End If
Next datax
End Function
This lets me enter the following in cell A61: =countccolor(A$2:A59;B61)

However, if I change the color of a cell (i.e. a whole row) in the range, the totals in the cells using the =countccolor function don't update. I have to click them and press f2 (or just double click them) and then enter, before the count changes. How can I make them update/run/execute/whatever it's called, whenever a I change a the formatting of a row?