I have a VBA that counts the number of COLORED CELLS. The VBA module is asigned to a cell. But, the function only runs when the i click on the cell function and press ENTER. Changing a cell value does not run the function automatically. AUTOMATIC UPDATE of formulas are enabled in options too.
Here's my VBA:
Function ColorFunction(rColor As Range, rRange As Range, Optional SUM As Boolean)
Dim rCell As Range
Dim lCol As Long
Dim vResult
lCol = rColor.Interior.ColorIndex
If SUM = True Then
For Each rCell In rRange
If rCell.Interior.ColorIndex = lCol Then
vResult = WorksheetFunction.SUM(rCell, vResult)
End If
Next rCell
Else
For Each rCell In rRange
If rCell.Interior.ColorIndex = lCol Then
vResult = 1 + vResult
End If
Next rCell
End If
ColorFunction = vResult
End Function
and Im calling this module using the worksheet command : =ColorFunction(J70,$B$3:$BV$66)
Any help?? Thanx