CountIfVisible?

Joined
Oct 3, 2006
Messages
2
Reaction score
0
I'm trying to implement a countif for visible cells. When I use the filter it doesn't seem to affect the values I get back for xlCellTypeVisible. This is my function, I'm sure I am doing something stupid.


Function CountIfVisible(UserRange, criteria)
Dim count As Integer
count = 0
For Each cell In UserRange.SpecialCells(xlCellTypeVisible)
If cell.Value = criteria Then
count = count + 1
End If
Next cell
CountIfVisible = count
MsgBox count
End Function

Thanks for any help,
Dave
user_online.gif
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top