title: search engine using textbox and combobox
body: <p>i have a userform which use textbox and combobox as a search engine. combobox will have the header for some field in excel table, and user will enter search value in textbox. then it will display the data in the listbox</p>
  
  <p>example
  combobox values are "Client", "Commune","Year".lets say i choose "Client" and enter faa in the textbox then click on the search button and it will display all data about faa in the listbox. or if i choose "Year" and enter 1998, it will display all data on the year 1988 in the listbox</p>
  
  <p>the problem is my search button does not work, i have tried a few option but keep on getting error. below is example of my code in search button</p>
  
  <pre><code>    `Private Sub CommandButton2_Click()
  
      Dim sat, s As Long
      Dim deg1, deg2 As String
  
      If TextBox7.Value = "" Then
      MsgBox "Please enter a value", vbExclamation
      TextBox7.SetFocus
      Exit Sub
      End If
  
      If ComboBox3.Value = "" Or ComboBox3.Value = "-" Then
      MsgBox "Choose a filter field", vbExclamation
      ComboBox3.SetFocus
      Exit Sub
      End If
  
  
      deg2 = TextBox7.Value
      Select Case ComboBox3.Value
      Case "Commune"
      For sat = 2 To Cells(65536, "a").End(xlUp).Row
      Set deg1 = Cells(sat, "a")
      If UCase(deg1) Like UCase(deg2) &amp; "*" Then
      ListBox1.AddItem
      ListBox1.List(s, 0) = Cells(sat, "D")
      ListBox1.List(s, 1) = Cells(sat, "E")
      ListBox1.List(s, 2) = Cells(sat, "F")
      ListBox1.List(s, 3) = Cells(sat, "G")
      ListBox1.List(s, 4) = Cells(sat, "H")
      ListBox1.List(s, 5) = Cells(sat, "I")
      ListBox1.List(s, 6) = Cells(sat, "J")
      ListBox1.List(s, 7) = Cells(sat, "K")
      s = s + 1
      End If: Next
  
      Case "Client"
      For sat = 2 To Cells(65536, "b").End(xlUp).Row
      Set deg1 = Cells(sat, "b")
      If UCase(deg1) Like UCase(deg2) &amp; "*" Then
      ListBox1.AddItem
      ListBox1.List(s, 0) = Cells(sat, "D")
      ListBox1.List(s, 1) = Cells(sat, "E")
      ListBox1.List(s, 2) = Cells(sat, "F")
      ListBox1.List(s, 3) = Cells(sat, "G")
      ListBox1.List(s, 4) = Cells(sat, "H")
      ListBox1.List(s, 5) = Cells(sat, "I")
      ListBox1.List(s, 6) = Cells(sat, "J")
      ListBox1.List(s, 7) = Cells(sat, "K")
      s = s + 1
      End If: Next
  
      Case "Year"
      For sat = 2 To Cells(65536, "d").End(xlUp).Row
      Set deg1 = Cells(sat, "d")
      If UCase(deg1) Like UCase(deg2) &amp; "*" Then
      ListBox1.AddItem
      ListBox1.List(s, 0) = Cells(sat, "D")
      ListBox1.List(s, 1) = Cells(sat, "E")
      ListBox1.List(s, 2) = Cells(sat, "F")
      ListBox1.List(s, 3) = Cells(sat, "G")
      ListBox1.List(s, 4) = Cells(sat, "H")
      ListBox1.List(s, 5) = Cells(sat, "I")
      ListBox1.List(s, 6) = Cells(sat, "J")
      ListBox1.List(s, 7) = Cells(sat, "K")
      s = s + 1
      End If: Next
  
     End Select
     End Sub`
  </code></pre>