Hi Everyone,
this is my first post on this forum. I'm writing cause I can't find a satisfying solution to my problem.
I need to count the number of cells with specific Interior Colour. For now, to do so I was using Visual Basic function as below:
To sum up:
I want to modify the above function so that it counts for cells with the same interior colour as the selected one (and includes cells with conditional formatting).
Thank you for your time and help.
this is my first post on this forum. I'm writing cause I can't find a satisfying solution to my problem.
I need to count the number of cells with specific Interior Colour. For now, to do so I was using Visual Basic function as below:
VBA Code:
Function CountColor(CellsRange As Range, ReferenceCell As Range)
Dim indRefColor As Long
Dim Format As Range
Application.Volatile
CountColor= 0
indRefColor = ReferenceCell.Interior.Color
For Each cell In CellsRange
If indRefColor = cell.Interior.Color Then
CountColor= CountColor+ 1
End If
Next
End Function
To sum up:
I want to modify the above function so that it counts for cells with the same interior colour as the selected one (and includes cells with conditional formatting).
Thank you for your time and help.
Last edited by a moderator: