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
msb20Asked:
Who is Participating?
 
vincem1099Connect With a Mentor Commented:
Does this modfication do what you are looking for?
Sub Macro1()
Dim lastrow As Long
lastrow = Range("b65535").End(xlUp).Row
If ActiveSheet.TextBox1.Text <> "" Then

Range("A3:C3").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

0
 
msb20Author Commented:
you did it man

Thanks soooo much
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.