filter code help

S

scrabtree

Here is a code:

Selection.AutoFilter Field:=18, Criteria1:=Sheets
("Code").Range("J2").Value

This code works fine; however, I need it to filter to
everything that does not equeal Sheets("Code").Range
("J2").Value not everything that equals it?
 
T

Tom Ogilvy

Selection.AutoFilter Field:=18, Criteria1:="<>" & Sheets _
("Code").Range("J2").Value
 
M

Myrna Larson

Tom gave you the answer, but remember that you can turn on the macro recorder
before you set up the filter. It will give you the appropriate commands.
 
Top