0
我有以下宏CountCellsByColor(ORIGNAL BELOW)但是我想修改它,以便通过颜色和单元格的特定文本统计单元格。使用COUNTIF来计算颜色的单元格
例如:该范围有5个不同的名称,所有颜色的颜色都不同。我希望宏只对与参考单元具有相同名称和颜色的单元格进行计数。即 “弗雷德”“数yellow'cells
原配方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
感谢杰里米,你原来的工作意见即 - 如果indRefColor = cellCurrent.Interior.Color而cellCurrent.Value = SEARCHTEXT然后 - 我只是didnt进入它最初写。非常感谢您的协助。真的很感激它 – d735