ColorIndex count function
Hi Howard,
Am Wed, 24 Aug 2016 03:21:40 -0700 (PDT) schrieb L. Howard:
I do have a problem with the function call formulas in a row (row 18 & pulled across many columns) =ColCnt(C4:C17) because adding a color to a cell does not fire the function formula.
try it this way:
Function ColCnt(myRng As Range, Optional FC As Boolean) As Long
Dim rngC As Range
Application.Volatile
For Each rngC In myRng
Select Case FC
Case False
If rngC.Interior.ColorIndex < xlNone Then
ColCnt = ColCnt + 1
End If
Case True
If rngC.Font.ColorIndex < xlAutomatic Then
ColCnt = ColCnt + 1
End If
End Select
Next
End Function
If you change the color you can press F9 to calculate new.
Regards
Claus B.
--
Windows10
Office 2016
|