Function CountRedComp(rCompRng As Range, sCompany As String, rSumRng As Range) As Double
Dim i As Long
CountRedComp = 0
With rSumRng
For i = 1 To rSumRng.Cells.Count
If rCompRng.Cells(i).Value = sCompany Then
If rSumRng.Cells(i).Font.Color = 255 Then
CountRedComp = CountRedComp + 1
End If
End If
Next i
End With
End Function
I use this code to count red cells from a certain company
It works although it only seems to count the first row in my range
There must be a way to continue onto the next row!
Please help
Example:
Formula:
=CountRedComp($E$1:$AFE$1,"companyname",E2:AFE8)
Bookmarks