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!!
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

Forum statistics

Threads
1,214,832
Messages
6,121,843
Members
449,051
Latest member
excelquestion515

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