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: 13
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.
 
Upvote 0

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
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.
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,843
Members
449,051
Latest member
excelquestion515

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