Autofilter for Three items?

redhots4

Board Regular
Joined
Aug 30, 2004
Messages
136
Office Version
  1. 365
Platform
  1. MacOS
I want to click the down arrow from an autofilter and show rows where <Status Column> = Open or Research or Closed. (There are 10 statuses shown in that column.)

How can I configure the autofilter to this level of customization?

Thanks in advance!! :eek:
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
I would suggest using Advanced Filter.
Below code will run advanced filter:
Code:
Sub FilterToAnotherSheet2()
    Dim FilterRange As Range, Criteria As Range, TargetRange As Range
    Dim CurrentData As Range, AF_Criteria As Range
'Clear old data first
    Sheets("Sheet3").Cells.ClearContents
'Set Range names
    On Error Resume Next
    ActiveWorkbook.Names("CurrentData").Delete                       'Delete old Name
    Sheets("Sheet1").Range("B1").CurrentRegion.Name = "CurrentData"  'ReName the range
    ActiveWorkbook.Names("AF_Criteria").Delete                       'Delete old Name
    Sheets("Sheet2").Range("B1").CurrentRegion.Name = "AF_Criteria"  'ReName the range
'Assign variables
    Set AF_Criteria = Sheets("Sheet2").Range("B1").CurrentRegion     '"Set" variable to use it later
    Set FilterRange = Sheets("Sheet1").Range("CurrentData")
    Set Criteria = AF_Criteria
    Set TargetRange = Sheets("Sheet3").Range("A1")
'Run Advanced Filter
    FilterRange.AdvancedFilter Action:=xlFilterCopy, _
        CopyToRange:=TargetRange, CriteriaRange:=Criteria
    
    Sheets("Sheet3").Select
End Sub
This code assumes the following:
The data to filter exists in Sheet1
Your Criteria exists in Sheet2, must contain the same header row as Sheet1 data with advanced filter criteria in rows below. Like Open, Research and Closed in the proper column.
Sheet3 exists for Advanced filter output.
 
Upvote 0

Forum statistics

Threads
1,214,834
Messages
6,121,874
Members
449,056
Latest member
ruhulaminappu

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