hailstorm

New Member
Joined
Sep 14, 2019
Messages
34
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.

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
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Welcome to the forum!

Try doing it manually first. If it works, then record a macro to get the syntax.

If you were looking for something like "00" within the numeric value, a helper column may be needed. Filter on that column for True. e.g. In C2 and fill down.
Code:
=NOT(ISERROR(FIND("00",A2)))
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,805
Messages
6,121,664
Members
449,045
Latest member
Marcus05

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top