Link to home
Start Free TrialLog in
Avatar of msb20
msb20

asked on

Autofilter based on Textbox

Hi
I have been stuck with VBA code , i tried to search using textbox when i type first letter all the list got sorted , the second letter cursor go automatically to the down cell.
my question is how to search smoothly without cursor interrupting.
Sub Macro1()
Dim lastrow As Long
lastrow = Range("b65535").End(xlUp).Row
If ActiveSheet.TextBox1.Text <> "" Then

Range("A3:C3").Select
Selection.AutoFilter
ActiveSheet.Range("$A$3:$c$" & lastrow).AutoFilter field:=2, Criteria1:= _
"=" & ActiveSheet.TextBox1.Text & "*", Operator:=xlOr
Else
ActiveSheet.Range("$A$3:$c$" & lastrow).AutoFilter field:=2
End If
End Sub  

Open in new window

autofilter.xlsm
ver.  Excel 2007

Thanks in Advance



09111432104524.th.png
ASKER CERTIFIED SOLUTION
Avatar of vincem1099
vincem1099
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of msb20
msb20

ASKER

you did it man

Thanks soooo much