Advanced Filter CriteriaRange

johnbird1988

Board Regular
Joined
Oct 6, 2009
Messages
197
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
 

Boisgontier

New Member
Joined
Feb 8, 2009
Messages
31
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:

Forum statistics

Threads
1,086,125
Messages
5,387,986
Members
402,094
Latest member
Bloody69

Some videos you may like

This Week's Hot Topics

Top