Advanced Filter CriteriaRange

johnbird1988

Board Regular
Joined
Oct 6, 2009
Messages
199
Hello,

I have the code below that does work except for one variable (crit) I have changed.

Code:
With Data
        Set crit = .Resize(2, 1).Offset(, lc.Column + 1)
        crit = [{"Season";"<>"}] & Me.cbo_Season.Value

        Set ws = Sheets.Add
        .AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=crit, CopyToRange:=ws.Range("A1")
        .Clear
        ws.Columns("A:AS").Copy .Range("A1")
        Application.DisplayAlerts = False
        ws.Delete
        Application.DisplayAlerts = True
    End With

I wanted to filter my range using Season not equal to Combo Box Season on a UserForm. The original one workfile but was static and looked like this
Code:
crit = [{"Season";"<>2016/2017"}]

Any idea on how I can get this to work with a combo box would be very help full.

Thank you

John
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Hello,

-I suppose that BD is in A1:Fx
-I suppose that year of BD is in column E
-The criteria must be a range (M1:M2 e.g. ) named crit
-In M1: Nothing and In M2: =AND(E2<>1960,E2<>1970)


Boisgontier
 
Last edited by a moderator:
Upvote 0

Forum statistics

Threads
1,215,377
Messages
6,124,597
Members
449,174
Latest member
chandan4057

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