Maybe :
Code on Sheet1 :
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$E$1" Then SearchT
End Sub
Code on Module1:
Option Explicit
Option Private Module
Sub SearchT()
Dim a, e As Long, i As Long, p As Long, strSearch As String, z As New Collection
With Sheets("Select-Item")
strSearch = .Range("E1").Value
a = .Range("A2:C" & .Cells(.Rows.Count, "A").End(xlUp).Row)
For i = 1 To UBound(a, 1)
If InStr(1, a(i, 1), strSearch, vbTextCompare) Then
On Error Resume Next
z.Add Key:=CStr(a(i, 1)), Item:=Empty
e = Err.Number
On Error GoTo 0
If e = 0 Then
p = p + 1
a(p, 1) = a(i, 1)
a(p, 2) = a(i, 2)
a(p, 3) = a(i, 3)
End If
End If
Next i
Application.ScreenUpdating = False
.Range("G2:I" & Application.Max(2, .Cells(.Rows.Count, "G").End(xlUp).Row)).ClearContents
If p Then
With .Range("G2").Resize(p, UBound(a, 2))
.Value = a
.Sort key1:=.Columns(1), order1:=xlAscending, header:=xlNo
.EntireColumn.AutoFit
End With
End If
Application.ScreenUpdating = True
End With
End Sub
Bookmarks