I have tried and tried to get the VBA code working that will tell me the number of visible rows in an autofiltered set of data, but the result I seem to be getting is always "1". Below is the most simple form of the code that I am using (it is based on previous posts and tutorials on this site). Can someone determine from this what I am doing wrong? (I have also attached a workbook with sample data and the code)
Code
With ActiveSheet
Set rnData = .UsedRange
With rnData
.AutoFilter Field:=1, Criteria1:="5"
.Select 'demonstrate that the rnData range is valid
lcount = .SpecialCells(xlCellTypeVisible).Rows.Count
End With
End With
Thanks in advance for any assistance!
Paul