I have the following macro CountCellsByColor (ORIGNAL BELOW) however I want to amend it so that it counts cells by color AND the specific text of the cell.
eg: The range has 5 different names all colored a different colour. I want the macro to only count the cells with the same name and color as the reference cell. ie Number of "Fred" 'yellow'cells
ORIGINAL FORMULA BELOW:
Function CountCellsByColor(rData As Range, cellRefColor As Range) As Long
Dim indRefColor As Long
Dim cellCurrent As Range
Dim cntRes As Long
Application.Volatile
cntRes = 0
indRefColor = cellRefColor.Cells(1, 1).Interior.Color
For Each cellCurrent In rData
If indRefColor = cellCurrent.Interior.Color Then
cntRes = cntRes + 1
End If
Next cellCurrent
CountCellsByColor = cntRes
End Function