We help IT Professionals succeed at work.
Get Started

Filtering VBA - Add Criteria

pdvsa
pdvsa asked
on
121 Views
Last Modified: 2020-03-22
Experts,

How can I add a criteria "Pending"  on line 23?  
I want to have 2 filters:  Issued and Pending

thank you


Sub Sort_LC()
'
' Sort_LC Macro
'

'
    Columns("A:AA").Select
    ActiveWorkbook.Worksheets("LC").Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("LC").Sort.SortFields.Add Key:=Range("M2:M20225"), _
        SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    ActiveWorkbook.Worksheets("LC").Sort.SortFields.Add Key:=Range("G2:G20225"), _
        SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    ActiveWorkbook.Worksheets("LC").Sort.SortFields.Add Key:=Range("B2:B20225"), _
        SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    With ActiveWorkbook.Worksheets("LC").Sort
        .SetRange Range("A1:AA20225")
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        
    End With
    ActiveSheet.Range("$A$1:$AA$2150").AutoFilter Field:=1, Criteria1:= _
        "=Issued", Operator:=xlOr, Criteria2:="="
    Range("A1").Select
    Sheets("pivot").Select
    ActiveSheet.PivotTables("Pivot_Banks_With_LC").PivotSelect "Status", xlButton, _
        True
    ActiveSheet.PivotTables("Pivot_Banks_With_LC").PivotCache.Refresh
    Sheets("LC").Select
    Range("A1").Select
End Sub

Open in new window

Comment
Watch Question
Excel & VBA Expert
CERTIFIED EXPERT
Most Valuable Expert 2018
Awarded 2015
Commented:
This problem has been solved!
Unlock 1 Answer and 8 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant

An Experts Exchange subscription includes unlimited access to online courses.

Get Started
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE