I have an userform with 6 comboboxes, named combobox1, combobox2, combobox3, combobox4, combobox5, combobox6 and a listbox named listbox1.
I have a textbox named textbox1 and a button named commandbutton1.
I want to filter the listbox with criteria in the comboboxes such as "> 200" or "< 1000."
So if I select ">200" in combobox1 and ">5000" in combobox2 the items where this is true would populate the listbox.
I have searched and found this thread https://www.mrexcel.com/forum/excel...utofilter-2.html?highlight=listbox+search+vba However the code doesn't do what I am trying to do.
Do I need to use autofilter? Where do I start?
I have a textbox named textbox1 and a button named commandbutton1.
I want to filter the listbox with criteria in the comboboxes such as "> 200" or "< 1000."
So if I select ">200" in combobox1 and ">5000" in combobox2 the items where this is true would populate the listbox.
Code:
Private Sub CommandButton1_Click()
Dim Crit1 As String
Dim Crit2 As String
Dim Crit3 As String
Dim Crit4 As String
Dim Crit5 As String
Dim Crit6 As String
Crit1 = ComboBox1.Value
Crit2 = ComboBox2.Value
Crit3 = ComboBox3.Value
Crit4 = ComboBox4.Value
Crit5 = ComboBox5.Value
Crit6 = ComboBox6.Value
End Sub
I have searched and found this thread https://www.mrexcel.com/forum/excel...utofilter-2.html?highlight=listbox+search+vba However the code doesn't do what I am trying to do.
Do I need to use autofilter? Where do I start?