Hi,
Need help on below code. If u refer to the pic attached, i need to input the condition at an empty cell to count certain color. Is there a way to count "all the colors" without need to conditioning it ? Maybe with a button click will display all the colors with the counts ??
![]()
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
CUrrent image:
color2.JPG
Bookmarks