title: VBA combobox with autocomplete and search as you type
body: <p>I have the below code which creates a userform with autocomplete which I copied from another website. I would like to modify this to include a "search as you type" feature. for example:</p>
  
  <p>the table the combo box references is 1 column and includes items like this:</p>
  
  <pre><code>chevy truck
  ford truck
  truck
  chevy car
  ford car
  car
  </code></pre>
  
  <p>Currently when the user types "truck" the only result and suggestion is "truck" and will not show 'chevy truck'</p>
  
  <p>I would want the drop down list to show something like this when the user searches 'truck'</p>
  
  <pre><code>truck
  chevy truck
  ford truck
  </code></pre>
  
  <p>or if the user types "tr" the list will show:</p>
  
  <pre><code>truck
  chevy truck
  ford truck
  </code></pre>
  
  <p>user types 'che'...list shows:</p>
  
  <pre><code>chevy truck
  chevy car
  </code></pre>
  
  <p>etc. </p>
  
  <pre><code>Private Sub OEM_Change()
  Dim x, dict
  Dim i As Long
  Dim str As String
  'x = this is where i need help.
  Set dict = CreateObject("scripting.dictionary")
  str = Me.OEM.Value
      If str &lt;&gt; "" Then
          For i = 1 To UBound(x, 1)
              If InStr(LCase(x(i, 1)), LCase(str)) &gt; 0 Then
                  dict.Item(x(i, 1)) = ""
              End If
          Next i
      Me.OEM.List = dict.keys
      Else
      Me.OEM.List = x
      End If
      Me.OEM.DropDown
  
  End Sub
  
  Private Sub UserForm_Initialize()
  
  With Vertical
       .AddItem "vertical1"
       .AddItem "vertical2"
       .AddItem "vertical3"
       .AddItem "vertical4"
       .AddItem "vertical5"
  End With
  
  End Sub
  
  Private Sub Vertical_Change()
  
  Dim index As Integer
   index = Vertical.ListIndex
  
  Select Case index
       Case Is = 0
           With OEM
               .RowSource = "Namedrange1"
           End With
       Case Is = 1
           With OEM
               .RowSource = "Namedrange2"
           End With
       Case Is = 2
           With OEM
              .RowSource = "Namedrange3"
           End With
      Case Is = 3
           With OEM
              .RowSource = "Namedrange4"
           End With
      Case Is = 4
           With OEM
              .RowSource = "Namedrange5"
           End With
  
  End Select
  
  End Sub
  </code></pre>
  
  <p>for reference: some of this code came from this thread </p>
  
  <p><a href="https://stackoverflow.com/questions/44076069/searchable-combo-box-with-a-list-of-sugggestion-on-a-userform?">searchable combo box with a list of sugggestion on a userform</a></p>