'Variable for the criteria in autofilter with "not equal" <>

I need help!!!!

Here is the problem:

Range("$A$5:$Y$118150").AutoFilter Field:=5, Criteria1:="<>" & MSN.keys, Operator:=xlFilterValues

This code compiles but no critera are actived.

If I do the opposite it works :

Range("$A$5:$Y$118150").AutoFilter Field:=5, Criteria1:=MSN.keys, Operator:=xlFilterValues

I probably have a syntax error but I fail to find it.

Any idea?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source