I defined a function in excel called "totaal" counting the cells with a specific color.
In several cells I entered a formula like "=totaal(B13:Z13)" with varying ranges.
How do I update the cells with the function on changing the sheet.
Code:
Function totaal(rng As Range) As Integer
Application.Volatile
totaal = 0
For Each Cell In rng
If Cell.Interior.color = 5287936 Then
totaal = totaal + 1
End If
Next
End Function
In several cells I entered a formula like "=totaal(B13:Z13)" with varying ranges.
How do I update the cells with the function on changing the sheet.