Auto Filter on input box?

wmtsub

Active Member
Joined
Jun 20, 2018
Messages
322
Currently I am using a column to get the first letter of the adjacent column [company names] and then use the filter drop down box to narrow the viewable results to just that letter.
So in a few keystrokes I can filter to all companies that start with the letter "D". But this entails selecting the drop down box, clearing select all, scrolling to the desired letter and checking it.

So I was wondering if there was a way to create an input box where I could just enter a letter and have it automatically do the rest?
any ideas?
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
No need for a helper column. If your company names are in col A with a header in row 1. Try
Code:
Sub fltr()
   Range("A1").AutoFilter 1, InputBox("Please enter the search letter") & "*"
End Sub
 
Upvote 0
This is working great thanks.
One thing though, sometimes after the filter it starts at the top of the list and others at the bottom. How can I force it to always start at the top left of the list?
 
Upvote 0
I'm afraid I don't understand what you're asking.
 
Upvote 0
When I apply your macro, lets say it returns a list of 20 lines. Sometimes I need to scroll to the top if the list and some times the cursor is already at the top of the list.
I would like to always start at the top of the list.
 
Upvote 0
Just add
Code:
Application.Goto Range("A1"), True
 
Upvote 0
As the filter is being applied to row1, A1 should always be visible
 
Upvote 0
Sorry to trouble you again. I tried to apply the original macro to another cell, C2 and it would not work.
Is this not right?

Sub fltr_2()
Range("c2").AutoFilter 1, InputBox("Please enter the search letter") & "*"
End Sub
 
Upvote 0
It should be
Code:
Range("c2").AutoFilter [COLOR=#ff0000]3[/COLOR], InputBox("Please enter the search letter") & "*"
 
Upvote 0

Forum statistics

Threads
1,215,575
Messages
6,125,616
Members
449,238
Latest member
wcbyers

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