[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 305
  • Last Modified:

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
0
msb20
Asked:
msb20
1 Solution
 
vincem1099Commented:
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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now