Search code examples
excelvbaasteriskautofilter

Excel VBA Autofilter Values Not Equal To Asterisk (*)


The problem I'm having is that i need to be able to filter for everything in specific columns that are not equal to "*". Also, I can't just filter simply by blanks as i have multiple values in the columns.

So far i have tried:

ActiveSheet.Range("$A$1:$Q$5000").AutoFilter Field:=5, Criteria1:="<>*"

And

ActiveSheet.Range("$A$1:$Q$5000").AutoFilter Field:=5, Criteria1:="<>" & "*"

Is this possible given the unique nature of the asterisk? Any solutions would be much appreciated!


Solution

  • Use the ~ to escape the wildcard:

    Criteria1:="<>~*"