Discussion:
SpecialCells(xlCellTypeVisible)
(too old to reply)
Ty
2015-11-07 20:42:28 UTC
Permalink
Attempt to use "For Each TCell In CountRange.SpecialCells(xlCellTypeVisible)" for my excel problem. It is not working.

Problem: Only want to count colored cells that are filtered. Do not want count the hidden rows/cells.

Do anyone have an answer to my problem?

Function CountByColor(ICol as integer, CountRange As Range)

Application.Volatile

Dim TCell As Range

For Each TCell In CountRange.SpecialCells(xlCellTypeVisible)
If ICol = TCell.value Then
CountByColor = CountByColor + 1
End If
Next TCell
End Function

Thanks,
Ty
Evertjan.
2015-11-07 21:26:06 UTC
Permalink
Post by Ty
Function CountByColor(ICol as integer, CountRange As Range)
Wrong NG, the above is VB or VBA, not VBS.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Loading...