How to get the range of the visible rows after applying an advanced filter in Excel (VBA)

Viewed 105402

Here is the code that applies an advanced filter to the column A on the Sheet1 worksheet (List range) by using the range of values on the Sheet2 (criteria range):

Range("A1:A100").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _
        Sheets("Sheet2").Range("A1:A10"), Unique:=False

After running this code, I need to do something with the rows that are currently visible on the screen.

Currently I use a code like this:

For i = 1 to maxRow
   If Not ActiveSheet.Row(i).Hidden then
     ...do something that I need to do with that rows
   EndIf
Next

Is there any simple property that can give me a range of rows visible after applying an advanced filter?

3 Answers
Related