Return of Multiple Match Results Automatically

How to return multiple match results automatically with VBA using Auto-Filter and a wild card character.

Watch the video below:

Here’s the complete macro or VBA code to automatically extract multiple search results from Excel data:

Sub ReturnMultipleMatchResults()
Dim sName As String
Dim ws As Worksheet

Set ws = Worksheets(“Sheet1”)
Range(“H1:L15”).Clear
sName = InputBox(“Enter the sales person’s first name followed by an asterisk(*)”, “Sales Person”)
‘ws.Range(“A1:E13”).AutoFilter
ws.Range(“A1:E13”).AutoFilter field:=1, Criteria1:=sName
ws.Range(“A1:E13”).SpecialCells(xlCellTypeVisible).Copy
ws.Range(“H1”).PasteSpecial Paste:=xlPasteAll
Application.CutCopyMode = False
ws.AutoFilterMode = False

End Sub