Hello there!!
I have two textbox in my sheet, one in column A and the other in column B, that is because i want the user to search in two ways, by typing the ID of the product and/or the product itself.
Column B works perfectly, i type the product name and it filters just the way i want it, but Column A which contains only numbers ( Product ID ) it does not filter, i receive a empty/blank result.
I'm pretty new to this stuff so i don't know how to fix that. Could you guys help? Thanks.
I have two textbox in my sheet, one in column A and the other in column B, that is because i want the user to search in two ways, by typing the ID of the product and/or the product itself.
Column B works perfectly, i type the product name and it filters just the way i want it, but Column A which contains only numbers ( Product ID ) it does not filter, i receive a empty/blank result.
I'm pretty new to this stuff so i don't know how to fix that. Could you guys help? Thanks.
Code:
Private Sub TextBox1_Change()
If Len(TextBox1.Value) = 0 Then
Planilha1.AutoFilterMode = False
Else
If Planilha1.AutoFilterMode = True Then
Planilha1.AutoFilterMode = False
End If
Planilha1.Range("A2:H" & Rows.Count).AutoFilter field:=1, Criteria1:="*" & TextBox1.Value & "*"
End If
End Sub
Private Sub TextBox2_Change()
If Len(TextBox2.Value) = 0 Then
Planilha1.AutoFilterMode = False
Else
If Planilha1.AutoFilterMode = True Then
Planilha1.AutoFilterMode = False
End If
Planilha1.Range("A3:H" & Rows.Count).AutoFilter field:=2, Criteria1:="*" & TextBox2.Value & "*"
End If
End Sub