fixing problem autofilter

abdelfattah

Well-known Member
Joined
May 3, 2019
Messages
1,429
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
hello
i need help about my code when i search by code in textbox it doesn't show anything
this is my data
1.JPG


the problem when i write in textbox number of code
2.JPG



VBA Code:
Private Sub TextBox1_Change()
Dim LastRow As Long
LastRow = Range("b1000").End(xlUp).Row
If ActiveSheet.TextBox1.Text <> "" Then
Range("$A$3:$m$" & LastRow).AutoFilter field:=3, Criteria1:= _
"=" & ActiveSheet.TextBox1.Text & "*", Operator:=xlOr
Else
Range("A3:m3").AutoFilter
Range("A3:m3").AutoFilter
End If
End Sub
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
You're filtering column C for the value of 4, hence nothing shows.
 
Upvote 0
hi, Fluff
so you say the same first number in three rows how i can change that to make in the last three numbers because of them are different
 
Upvote 0
I'm afraid I haven't got a clue what you are saying.
 
Upvote 0
if you mean the number 4 is existed in the same theses code 459730901,466316086,466157997 i'm talking about the first number in theses code

i changed the first number in theses code to become this 459730901,566316086,666157997 not happen any thing this the same problem
 
Upvote 0
You are filtering on column C which does not have any numbers, just names.
 
Upvote 0
also i changed filtering in column b i changed this
from
VBA Code:
Range("$A$3:$m$" & LastRow).AutoFilter field:=3, Criteria1:= _
to
Code:
Range("$A$3:$m$" & LastRow).AutoFilter field:=2, Criteria1:= _
this is the same problem no change anything
 
Upvote 0
Ok, try it like
VBA Code:
   Range("A3:M" & LastRow).AutoFilter 2, ">=400000000", xlAnd, "<=499999999"
 
Upvote 0
not completely it comes the only first code if i search another number it stays the first code just this number 459730901
 
Upvote 0
VBA Code:
   Range("A3:M"&lastrow).AutoFilter 6, ">=" & ActiveSheet.TextBox1.Text * 100000000, xlAnd, "<" & (ActiveSheet.TextBox1.Text + 1) * 100000000
 
Upvote 0

Forum statistics

Threads
1,213,515
Messages
6,114,080
Members
448,548
Latest member
harryls

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