VBA filter from multiple selection drop down list

npatzke

New Member
Joined
Apr 5, 2023
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hello,

I am in need of help on creating an activation button for a filter based on the value of another cell.
I currently have a multi-selection drop down box that outputs the selections made into an output cell.
When multiple items are selected, they are divided by a "/" symbol.
I have looked around for a VBA code I could modify to achieve this but cannot find anything.
Can someone please help?
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
a VBA code I could modify to achieve this
You could modify this:
VBA Code:
Option Explicit
Sub Array_Filter()
    Dim ws1 As Worksheet, ws2 As Worksheet
    Set ws1 = Worksheets("Sheet1")  '<~~ Change to actual sheet name with the 'dropdown' cell
    Set ws2 = Worksheets("Sheet2")  '<~~ Change to actual sheet name with range to be filtered
    
    Dim a
    a = Split(ws1.Range("A2"), "/") '<~~ Change A2 to actual cell with the dropdown with multiple selections
    
    With ws2.Range("A1").CurrentRegion  '<~~ Adjust range to suit your actual data range
        .AutoFilter 1, Array(a), 7      '<~~ Change 1 to whatever column has the values to be filtered
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,162
Messages
6,170,432
Members
452,326
Latest member
johnshaji

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