Try this solution - as you type, the dropdown displays and updates to show only the choices which partially match what is typed into the combobox. It may require some additional work, since when you have selected a valid choice, the list is still filtered for only that item until you clear the combobox, but it might give you what you need.
Create a module called mdlComboBox
with the following code
Public colChoices As Collection
Public Sub InitCombobox1()
Set colChoices = New Collection
With colChoices
.Add "John Smith"
.Add "Ted James"
.Add "Phillip Price"
.Add "Tom Hardy"
.Add "James Dean"
.Add "Chris Keaking"
End With
FilterComboBox1 ""
End Sub
Public Sub FilterComboBox1(strFilter As String)
Sheet1.ComboBox1.Clear
For Each strChoice In colChoices
If InStr(1, strChoice, strFilter) <> 0 Then
Sheet1.ComboBox1.AddItem strChoice
End If
Next
End Sub
In the ThisWorkbook
module, add the following to ensure that the ComboBox is populated when the Workbook opens:
Public Sub Workbook_Open()
InitCombobox1
End Sub
Finally, add a ComboBox (named ComboBox1
) to Sheet1
and add the following code to the Sheet1
module:
Private Sub ComboBox1_Change()
FilterComboBox1 ComboBox1.Value
ActiveSheet.Select
ComboBox1.DropDown
End Sub
The line Activesheet.Select
forces the combobox to redraw the dropdown from scratch, showing only the choices filtered by the function. In this solution, you have to keep track of the total set of choices, which I did in a Collection global variable, but there are situations in which it can lose its value, so it might be better to hard code or pull from a sheet instead.