Autofilter as you type in ComboBox

Mnet22

New Member
Joined
Sep 17, 2017
Messages
37
Dear Excel users, I have a problem to auto filter a predefined list in a combo-box. I have two comboboxes on a Userform - the first one calls up job numbers (Reg5) and the second one calls up activities (Reg6) that is related to whatever is selected in Reg5. Because the list in Reg 5 is massive I want to be able to filter the list as I type in a text or number. Any Suggestions? All help will be greatly appreciated!

Code:
Private Sub Reg5_Change()
       
    Reg6.Clear
    With Worksheets("Lists").Range("V3:V10000")
       Set C = .Find(Reg5.Text, LookIn:=xlValues, LookAt:=xlWhole)
        If Not C Is Nothing Then
           firstAddress = C.Address
           Do
               Me.Reg6.AddItem (C.Offset(, 1).Text)
               Set C = .FindNext(C)
           Loop While Not C Is Nothing And C.Address <> firstAddress
                          
      End If
   End With
   
                  
    Set myRange = Worksheets("Lists").Range("H3:L1000")

    Set f = myRange.Find(What:=Reg5.Value, LookIn:=xlValues, LookAt:=xlWhole, MatchCase:=False) '<--| try and find combobox selected value
    If f Is Nothing Then '<--| if not found ...
        Reg8.Value = "" '<--| ... then clear textbox
        
    Else '<--| ... otherwise...
        Reg8.Value = f.Offset(, 4) '<--| ... fill it with proper value
    End If
           
End Sub
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Dear Jaafar, thank you but it is not what I'm looking for - If I select a Job number (Reg5) it automatically filter the list to show the applicable Activities in Reg6 - So it is working perfectly. What I'm asking is that when I type a jobnumber in Reg5 it automatically filter Reg5 as I type to only show jobnumbers e.g. 1582350 and not the rest - alternatively I will also be happy if I can search Reg5 by typing in a number and it come up with that number....Any Suggestions????
 
Upvote 0

Forum statistics

Threads
1,216,027
Messages
6,128,370
Members
449,444
Latest member
abitrandom82

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