Filter macros further filtered by drop down selection?

coops_46

Board Regular
Joined
Jan 27, 2017
Messages
102
I have some macro buttons which filter data on time frames... They are housed in Sheet1 and they filter Sheet2.
An example of one is:

Code:
Sub ActivateAndSortLastWeek()Sheet2.Range("B:D,L:O,T:U,X:X").EntireColumn.Hidden = True
Dim lr As Long
    lr = Sheet2.Range("A" & Rows.Count).End(xlUp).Row
    Sheet2.Activate
    With Sheet2.Range("A1:X" & lr)
        .AutoFilter Field:=1, Criteria1:=xlFilterLastWeek, Operator:=xlFilterDynamic
    End With
End Sub

I'd like a combo box in Sheet 1, which contains a drop down list of supplier names. Supplier names are housed as a list in Sheet6 and are selected in Column D of Sheet2.
Is it possible that a supplier can be selected from the combo box, and then one of the time frame buttons is clicked, which applies the time filter but now also filters column D of Sheet2 to the specific supplier?

For this example lets say the supplier list will be:
All
Supplier 1
Supplier 2
Supplier 3
Supplier 4

I may have made this way more complex than I need to, but I'm not sure how to adapt the above code to cater for this additional filter.

Thanks in advance.
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Can the below be adapted so that "All" is another option, and if it is selected from the dropdown it doesn't apply any filters to column D?

Code:
Sub Supplier_Selection()

Sheets("Raw Data").Range("$A$1:$X$2000").AutoFilter


With Sheets("Home").DropDowns("Drop Down 1")
    Sheets("Raw Data").Range("$A$1:$X$2000").AutoFilter Field:=4, _
        Criteria1:=WorksheetFunction.Index(Range(.ListFillRange), .Value)
End With


End Sub
 
Upvote 0
Anyone? I need something like: where drop down value = "All" Autofilter Field:=4 = false
But not sure how to write and/or modify into the above.
 
Upvote 0

Forum statistics

Threads
1,216,025
Messages
6,128,341
Members
449,443
Latest member
Chrissy_M

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