PDA

View Full Version : Get Row Count after Filters have been Set



asingh
06-25-2006, 10:25 PM
Hi,

Suppose I have set filters on column "A". As per the data in column "A" I will see only a limited number of rows, as per my filter critereon. I now want to get the count of how many rows are currently displayed...??

How would this be possible with VBA..?


thanks....
asingh

asingh
06-26-2006, 12:17 AM
Was able to solve it using the following:


Sub Rtrv_Row_Count(Row_Count_Current)
'//first row count will be retrieved from here
Dim rng_active As Range

Set rng = ActiveSheet.AutoFilter.Range

Range("A1").Select

Row_Count_Current = ((rng.Columns(1).SpecialCells(xlVisible).Count) - 1)

Set rng_active = Nothing

End Sub

'//Now I will only get the count of how many rows are on display with filters applied as per the selection critereon.......!