I have a module in VB which counts the number of cells of a specified colour in a specified range, in a spreadsheet. See below:-
Function CountColor(Rng As Range, RngColor As Range) As Integer
Dim sell As Range
Dim Clr As Long
Clr = RngColor.Range("A1").Interior.Color
For Each sell In Rng
If sell.Interior.Color = Clr Then
CountColor = CountColor + 1
End If
Next sell
End Function
I now want another code / formula which will be more of a 'Countcolourif' style formula. I want it to count coloured cells if they contain a value = to zero, and in another case if they are >0.
I have no idea where to begin!! Any help / advice would be welcomed!
LexB
Function CountColor(Rng As Range, RngColor As Range) As Integer
Dim sell As Range
Dim Clr As Long
Clr = RngColor.Range("A1").Interior.Color
For Each sell In Rng
If sell.Interior.Color = Clr Then
CountColor = CountColor + 1
End If
Next sell
End Function
I now want another code / formula which will be more of a 'Countcolourif' style formula. I want it to count coloured cells if they contain a value = to zero, and in another case if they are >0.
I have no idea where to begin!! Any help / advice would be welcomed!
LexB