Function FindFiles(sRootFolder As String, sFiles As String) As Variant
Dim fs As Object
Dim strFilename As String
Dim i As Long, LastRow As Long
Dim a() As Variant
Set fs = Application.FileSearch
With fs
.LookIn = sRootFolder
.Filename = sFiles 'set your filename or extension with wilcards if needed.
.SearchSubFolders = True
LastRow = .FoundFiles.Count
If .Execute() > 0 Then
For i = 1 To LastRow
strFilename = .FoundFiles(i)
ReDim Preserve a(i - 1)
a(i - 1) = strFilename
Next i
Else
MsgBox "No files found", vbCritical
End If
End With
FindFiles = a()
End Function