VBA Autofilter Not Equal multiple criteria

BrianM

Well-known Member
Joined
Jan 15, 2003
Messages
768
Office Version
  1. 2016
Platform
  1. Windows
Hello,
I'm currently using the following to filter multiple criteria 'Equal to':

VBA Code:
    Dim ar As Variant
    Dim lngLastRow As Long
      
    Range("A1").AutoFilter 'Turn Filter On
    ar = Array("1", "2", "3", "4", "5", "6", "8", "9", "C", "N", "P", "Q", "R", "Y")
    Range("A1", Range("A" & Rows.count).End(xlUp)).AutoFilter 13, ar, xlFilterValues, , 0

How can I turn it into a 'Not Equal to' statement? I've tried "=<>1", "=<>2" etc, but that fails.

Thanks,
Brian
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
You can only filter on more than two values when using an exact match.
You have 3 options
1) Look at using advanced filters instead.
2) Put a formula in a blank column that returns true or false depending on whether that row should be visible & filter on that.
3) create an array of values that should be visible.
 
Upvote 0

Forum statistics

Threads
1,215,613
Messages
6,125,834
Members
449,266
Latest member
davinroach

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top