Hi hope someone can help, I have downloaded a VBA code seen below. it works fine but when a cell has no colour I need the cell count to read blank instead of 0. Do I have to have 3 different rules, 1: to count cells if they are yellow and input the number of coloured cells, 2: to count cells that have a colour pink to input a zero value and 3: to count none coloured cells to input a blank value. I am very new to this so bear with me, thanks in advance
VBA Project.jpg
Function CountCcolor(range_data As Range, criteria As Range) As Long
Application.Volatile True
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
Bookmarks