VBA code for Prompting/Displaying a Filter box for a specific column

Manoj Gaidhankar

New Member
Joined
May 27, 2022
Messages
20
Office Version
  1. 2021
Platform
  1. Windows
I need a code which selects the column and displays the Filter box as shown in the below image("This is a filter dropdown which allows us to select the list of values").

I want a code which follows the following steps

1) Select column A
2) Prompts us the Filter box as shown in the below picture for us to manually select the data
3) Later, Run the rest part of the code

I have a code already in place but its prompts for an Input box with the values("Manually") to be entered in it. But this is not the one which I want.

Please find the below reference image and the code as-well.

Sub Filer_Box()

Dim uiDeptToShow As String

uiDeptToShow = Application.InputBox("Show which Department", Type:=2)
If uiDeptToShow = "False" Then Exit Sub: Rem Cancel pressed

Range("A1:M1").Select

Selection.AutoFilter

Selection.AutoFilter Field:=1, Criteria1:="=" & uiDeptToShow, Operator:=xlAnd

End Sub

Image01.png
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hi Team,

I have cross posted the above concern but haven't received any update on this from past 2days

So, could you please help me solve this. Thank you.
 
Upvote 0

Forum statistics

Threads
1,215,457
Messages
6,124,941
Members
449,197
Latest member
k_bs

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