Altering AdvancedFilter to recognize range inputs and multiple values.

NotMisterExcell

New Member
Joined
Oct 7, 2014
Messages
1
Hey guys,

I've been googling for several weeks, and haven't been able to find a solution yet....so I created this account.

I've created a "Filter" sheet that contains various drop down lists with different quantities. Once I select my desired drop-down list values, I'll click the macro activation button "Apply Filter." After hitting this key, it'll apply the filter and paste the desired information right below my user interface section, just like this: Extract data using Advanced Filter and VBA | Chandoo.org - Learn Microsoft Excel Online.


Here is the code I use:
Code:
Sub FilterData()

    '  This section selects and clears prefiously filtered information from "Filter" tab
    Sheets("Filter").Select
    Range("B23").Select
    Range(Selection, Selection.End(xlToRight)).Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Clear
    

   '  Running the autofilter command
   Sheets("RawData").Range("A2:AH433").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:= _
      Sheets("RawData").Range("AL2:AP3"), CopyToRange:=Sheets("Filter").Range("B23"), Unique:=True
  
  
    ' Clears above selection
    Range("K4").Select
  
    
End Sub

I have two questions:
1) How do I make AdvancedFilter recognize a range of inputs rather that just a singular input?
For example if I have a column of integers ranging from 1 to 20, and I want excel to filter out all values except for 3-5 such that

2) How do I make AdvancedFilter recognize a value as both "yes" and "no" ?
For example if I have a drop down list with selections of "yes" , "no" and "N/A", how to I make VBA recognize "N/A" as both "yes" and "no"?
If done correctly, I would be able to select "N/A" on all of my drop down lists, and upon hitting the "Apply FIlter" button, all values from "RawData" would be copied into the section below my input interface in "Filter".

Please let me know if you need any more clarification.

Thanks!!
 

Forum statistics

Threads
1,085,301
Messages
5,382,808
Members
401,807
Latest member
xlWatcher

Some videos you may like

This Week's Hot Topics

Top