How to Filter Combo Box as User Typed?

riyajugen

New Member
Joined
Nov 10, 2020
Messages
9
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I have using one of ComboBox in UserForm and load the values from code behine function called while Userform Iniated. I need that ComboBox should filter and show as what user typed.

Eg:

Values are "OUTLET, SALES, SUPPLIER, SALES CATEGORY, PURCHASE, SALES MODE"
User type as "SA".. list items should displays "SALES, SALES CATEGORY, SALES MODE"
If values are empty, ComboBox should display with all items as beginning.

Coding as Follows:
VBA Code:
Private Sub UserForm_Initialize()
    CategoryListLoad
End Sub

Sub CategoryListLoad()
    On Error Resume Next
    ddlCategoryName.Clear
    ddlCategoryName.AddItem ("OUTLET")
    ddlCategoryName.AddItem ("SAPPLIER")
    ddlCategoryName.AddItem ("SALES CATEGORY")
    ddlCategoryName.AddItem ("PAYMENT MODE")
    ddlCategoryName.AddItem ("EMPLOYEES")
    ddlCategoryName.AddItem ("SERVICE PROVIDERS")
    ddlCategoryName.AddItem ("GENERAL EXPENSES")
    ddlCategoryName.AddItem ("MISCELLANEOUS EXPENSES")
    ddlCategoryName.AddItem ("VEHICLE TYPE")
    ddlCategoryName.AddItem "SELECT YOUR CATEGORY", 0
    ddlCategoryName.ListIndex = 0
    ddlCategoryName.SetFocus
End Sub

Private Sub ddlCategoryName_Change()
'Serach Filter function here.

End Sub
 

Attachments

  • Temp Userform.jpg
    Temp Userform.jpg
    49 KB · Views: 6

riyajugen

New Member
Joined
Nov 10, 2020
Messages
9
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
This is OK.
Is that all?
Maybe you calling procedure "Subcategory List Load()" after last line of this code or some event activate this procedure.
Go to the debugger and step by step see when the list duplicated.
Thanks, It's working fine, I have found where it's issue.

I haven't use control name as "TextBox1". It's working fine once change the control name.
 

Some videos you may like

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

EXCEL MAX

Active Member
Joined
Nov 11, 2020
Messages
380
Office Version
  1. 2007
Platform
  1. Windows
You were probably confused by this sentence...
"Clear combobox and fill it with items from collection that meet search parameter from text box".
My mistake.
I was mean "search parameter from combo text box".
But finaly we have find solution. That is great.
 

Watch MrExcel Video

Forum statistics

Threads
1,127,035
Messages
5,622,332
Members
415,894
Latest member
silverhaze

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
Top