I have list of file names in worksheet("sheet2"). I have to check for these files in a folder, if the file(s) exists then they should be copied to a new folder. I don't know where to start. Can any one guide me?
Dim rngFile as Range, cel as Range
Dim desPath as String, filename as String, sourcePath as String
Set rngFile = Thisworkbook.Sheets("Sheet2").Range("A1","A500") ' file list in ColA
desPath = "D:\withdate\" 'Destination folder is withdate
sourcePath = "D:\All\All\(fetch each cell for file name?)" 'source folde
For Each cel in rngFile
If Dir(sourcePath & cel) <> "" Then
FileCopy sourcePath & cel, desPath & cel 'copy to folder
End If
Next
End Sub
But the above code is not copying the files!