• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Why is this advanced filter macro not working

Guys,

I wrote the following VBA code to automate an advanced filter.

Sub Macro1()

Sheets("Nummers").Range("B2:H5817").AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Range("B2:H4"), CopyToRange:=Range("B6:H6"), Unique:=False
End Sub

When I hit it I do not get any records though... Even if I enter no conditions. Any thoughts on what goes wrong here?

Excel is attached.
 

Attachments

  • sony_compare_echo.xlsm
    628.7 KB · Views: 10
Hi Marc !

Your initial attachment seems to work on my side …
Maybe you forgot to reset previous filter as you can see here :
Adv Filteren .gif
 
@vletm
List Range in screen shot shouldn't matter. In most instances, it automatically adjusts to CurrentRegion whenever Advanced Filter button is clicked.

However, as List Range is defined in the code, this range has no relevance when the code is run.
 
Hi ,

Everything works correctly , whether through the ribbon menu options or through the code.

The only comment I have is that the signs should be > and < , not > and > as in the file.

Narayan
 

Attachments

  • sony_compare_echo.xlsm
    648.6 KB · Views: 5
Back
Top