change code search from first letter to any location letter for any loction name into cell

Alaa mg

Active Member
Joined
May 29, 2021
Messages
378
Office Version
  1. 2019
I have textbox1 inside the sheet (ACTIVEX ) and the code bleow search just based on first letter and first name . so what I want if I have many names into cells in column B then when I write the letter fo any location and for any name into cell ,then should filter and show the names which contain the letter up to finish writing ,then show the name based on whole word is written in textbox1 . for instance if I have two names in B8= "Alaa amir malla" then when I write any letter whether first or second or third name , then should filter and show the names contain the letter is written in textbox1 up to finish writing the whole name .
VBA Code:
Private Sub TextBox1_Change()
Dim MySerch As String
If ib Then Exit Sub
MySerch = CStr(Me.TextBox1)
Range("N3").Value = "=Search(""" & MySerch & """,B4)=1"
Me.Range("B3").Resize(Me.UsedRange.Rows.Count, 2).AdvancedFilter xlFilterInPlace, Me.Range("N2:N3")
End Sub
I hop some help
 

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.
How about
VBA Code:
Range("N3").Value = "=isnumber(Search(""" & MySerch & """,B4))"
 
Upvote 0
Solution
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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