See attached file, I hope it can help you.
This is the macro, In range B2 put the path where to look for files and in range A5:An put files to search:
Sub Macro1()
Dim fso As Object, myPath As String
Dim lastRow As Long, r As Long
Dim myFiles As Range
Dim myFolder, myFile
Set fso = CreateObject("Scripting.FileSystemObject")
myPath = Range("b2")
lastRow = Cells(Rows.Count, "a").End(xlUp).Row
Set myFolder = fso.GetFolder(myPath).Files
For Each myFile In myFolder
For r = 5 To lastRow
If myFile Like "*" & Cells(r, "a") & "*" Then
Cells(r, "b") = myFile
End If
Next
Next
End Sub
Regards,
Antonio
Bookmarks