Counting Hidden Cells
Posted by David on June 01, 2000 6:01 PM
Greetings,
I'm trying to count visible cells in a named cell range so that I can filter data and have a number which represents the number of unfiltered rows. I can get the function (see below) to work in a sub routine but not in an excel formula (I get the #value message). Can someone please tell me where I'm going wrong:
Function DCountVisible(NamedRange As String) As Integer
Set RowsToCount = Range(NamedRange).CurrentRegion.Rows
For Each Row In RowsToCount
If Row.Hidden <> True Then
D2CountVisible = D2CountVisible + 1
End If
Next Row
End Function