View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Rech Jim Rech is offline
external usenet poster
 
Posts: 2,718
Default My Autofilter is overzealous!

You can check the count of matching rows with this function:

Function RowMatchCount(WS As Worksheet) As Long
Dim MatchCount As Long, Area As Range
For Each Area In
WS.Range("_FilterDatabase").SpecialCells(xlCellTyp eVisible).Areas
MatchCount = MatchCount + Area.Rows.Count
Next
RowMatchCount = MatchCount - 1
End Function

Sub Demo()
MsgBox RowMatchCount(Worksheets("Sheet1"))
End Sub


--
Jim Rech
Excel MVP