Hi all, I currently have a userform that has 4 comboboxes, all filtering from a table, with the last combobox being filtered to a single row match in the table. Once that match is made, textboxes are filled with the data contained in the adjacent row in the table.
I am using the below code to fill in these textboxes
Sub GetDataCBbased()
Dim wo As Long, i As Integer, j As Integer, flag As Boolean
If IsNumeric(UserForm1.ComboBox4.Value) Then
flag = False
i = 0
wo = UserForm1.ComboBox4.Value
Do While Cells(i + 1, 1).Value <> ""
If Cells(i + 1, 1).Value = wo Then
flag = True
For j = 5 To 12
UserForm1.Controls("TextBox" & j).Value = Cells(i + 1, j).Value
Next j
End If
i = i + 1
Loop
If flag = False Then
For j = 5 To 12
UserForm1.Controls("TextBox" & j).Value = ""
Next j
End If
Else
ClearForm
End If
End Sub
This all works fine, but the search is only being constrained to the selection made in the final combobox, this would be fine however, that value is not unique in the table, so I am missing rows of data in the results of my UserForm. So my question is if I can constrain the search to all the combobox selections rather than just the last one.
Any assistance would be greatly appreciated as I've completely hit a roadblock with this. I attached the file below
Bookmarks