VBA macro Text Filters -> Contains

K0st4din

Active Member
Joined
Feb 8, 2012
Messages
488
Office Version
  1. 2016
  2. 2013
  3. 2011
  4. 2010
  5. 2007
Platform
  1. Windows
Hello, everyone,
please for your assistance.
I have made a VBA form in which there is TextBox1.
I want to write something to find it in the selected worksheet named "Base" and column "P". (this part is most difficult for me to do).
I mean - Text Filters -> Contains
I would be very grateful if you could help me.
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Let's Start here...

Paste the below code in the code window of your BASE worksheet.

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$P$4" Then
Target.Value = TextBox1.Value
End If
End Sub

Then Click on Cell P4 of your Worksheet "Base".
 
Upvote 0
Maybe something like
Code:
   Sheets("Base").Range("A1:P1").AutoFilter 16, "*" & TextBox1.Value & "*"
 
Upvote 0
Maybe something like
Code:
   Sheets("Base").Range("A1:P1").AutoFilter 16, "*" & TextBox1.Value & "*"
Thank you so much.
It has done a very good job, the macro.
Be alive and healthy.
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,800
Messages
6,121,641
Members
449,044
Latest member
hherna01

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