Sub findfileinfolder()
Call CountFiles
End Sub
Private Function CountFiles()
Dim strDirectory As String, strDestFolder As String, strExt As String, cell As Range
strDirectory = InputBox("pl inter path for serch folder")
strDestFolder = InputBox("pl inter path for output folder")
Dim myfilesystemobject As Object
Dim myfiles As Object
Dim myfile As Object
Dim rng As Range
Dim Compld As Range
Set myfilesystemobject = CreateObject("Scripting.FileSystemObject")
Set myfiles = myfilesystemobject.GetFolder(strDirectory).Files
For Each myfile In myfiles
Range("B1").ClearContents
Range("B1").Value = myfile.Name
Set Compld = Range("A:A").Find(what:=Range("B1").Value, LookIn:=xlValues, lookat:=xlWhole)
If Not Compld Is Nothing Then
'Stop
With myfile
.Copy strDestFolder & "" & myfile.Name
End With
Else
End If
Next myfile
Set rng = Nothing
Set myfiles = Nothing
Set myfilesystemobject = Nothing
End Function