VBA to filter when typing in a field

subtleskeptic

New Member
Joined
Sep 11, 2016
Messages
46
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hi all I have the below code that enables to me type into an activex text box, and it will filter for all matches in column 13 (N) - N1 is just where the link to active x box is
however, the data set is currently set up as a table, I'd like to just use a normal range, how can I change this code please? Current table name is "Data"

Private Sub TextBox1_Change()
Application.ScreenUpdating = False
ActiveSheet.ListObjects("Data").Range.AutoFilter Field:=13, Criteria1:="*" & [N1] & "*", Operator:=xlFilterValues
Application.ScreenUpdating = True
End Sub
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Change:
VBA Code:
ActiveSheet.ListObjects("Data").Range.AutoFilter
to your total range. Example
VBA Code:
ActiveSheet.Range("A2:L200").AutoFilter
 
Upvote 0

Forum statistics

Threads
1,215,022
Messages
6,122,721
Members
449,093
Latest member
Mnur

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