So I have a user form that has a combo box that filters the data with the codes
Private Sub Combobox1_change()
Me.ListBox1.Clear
For i = 2 To Application.WorksheetFunction.CountA(Sheet3.Range("D:D"))
If Sheet3.Cells(i, "D").Value = Me.ComboBox1.Value Then
Me.ListBox1.AddItem Sheet3.Cells(i, "A").Value
End If
Next i
End Sub
Private Sub userform_initialize()
Me.ComboBox1.List = Array("Vermeer 755", "2000-320", "2350-1320", "2300-323", "2300-423", "2300-823", "2300-1123", "2300-2023", "2500-1825", "2500-1325", "2500-925", "2450-2423")
End Sub
This code does the combobox list and makes a listbox list based on selection.
Now this code is on a textbox used to search the list for specific items
Sub Show_Product()
Me.ListBox1.Clear
For i = 2 To Application.WorksheetFunction.CountA(Sheet3.Range("A:A"))
If Me.TextBox1.Value = "" Then
Me.ListBox1.AddItem Sheet3.Range("A" & i).Value
Else
If VBA.InStr(UCase(Sheet3.Range("A" & i).Value), UCase(Me.TextBox1.Value)) > 0 Then
Me.ListBox1.AddItem Sheet3.Range("A" & i).Value
End If
End If
Next i
End Sub
Problem I'm having is that it brings up an unfiltered list meaning it brings up products of same name but for different equipment. Basically not searching just the list by the combobox but searching the whole sheet in general. How can I search just what was filtered from combobox.
Private Sub Combobox1_change()
Me.ListBox1.Clear
For i = 2 To Application.WorksheetFunction.CountA(Sheet3.Range("D:D"))
If Sheet3.Cells(i, "D").Value = Me.ComboBox1.Value Then
Me.ListBox1.AddItem Sheet3.Cells(i, "A").Value
End If
Next i
End Sub
Private Sub userform_initialize()
Me.ComboBox1.List = Array("Vermeer 755", "2000-320", "2350-1320", "2300-323", "2300-423", "2300-823", "2300-1123", "2300-2023", "2500-1825", "2500-1325", "2500-925", "2450-2423")
End Sub
This code does the combobox list and makes a listbox list based on selection.
Now this code is on a textbox used to search the list for specific items
Sub Show_Product()
Me.ListBox1.Clear
For i = 2 To Application.WorksheetFunction.CountA(Sheet3.Range("A:A"))
If Me.TextBox1.Value = "" Then
Me.ListBox1.AddItem Sheet3.Range("A" & i).Value
Else
If VBA.InStr(UCase(Sheet3.Range("A" & i).Value), UCase(Me.TextBox1.Value)) > 0 Then
Me.ListBox1.AddItem Sheet3.Range("A" & i).Value
End If
End If
Next i
End Sub
Problem I'm having is that it brings up an unfiltered list meaning it brings up products of same name but for different equipment. Basically not searching just the list by the combobox but searching the whole sheet in general. How can I search just what was filtered from combobox.