I have a function that takes range of cells, but I need to modify it to take certain cells (not A7:A14, but A7, A9, A10, A11, etc). I don't know how many cells I will need, so it need to be able to take an unknown number of cells.
Here is the existing code:
Function CountC(rng As Range, Cell As Range)
Dim CellC As Range, ucoll As New Collection
For Each CellC In rng
If CellC.Interior.Color = Cell.Interior.Color And worksheetFunction.IsText(CellC) Then
On Error Resume Next
If Len(CellC) > 0 Then ucoll.Add CellC, CStr(CellC)
On Error GoTo 0
End If
Next CellC
CountC = ucoll.Count
End Function
Range("A1,A5,A6,A10")
is just a range – Damian