Hell Everyone,
I'm currently stuck on this VBA Code. What I'm trying to do is copy files in a directory using an Excel macro.
For example, A2 is the source folder and B2 is the destination folder and C2 is the file name. The code that I use only work for the source & destination in the first column (i.e, the destination in B2 remains same for all the file names. The macro shared in the thread http://www.excelforum.com/showthread...13#post4542813 is for multiple files from one source folder to one destination folder. In my case source and destination folder change as per the list
Sub TESCO()
Dim src As String, dst As String, fl As String
Dim lngMyRow As Long
Dim lngLastRow As Long
Application.ScreenUpdating = False
lngLastRow = Range("A:B").Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1
Range("G1") = lngLastRow
Range("G2") = lngMyRow
'Source directory
src = Range("A2")
'Destination directory
dst = Range("C" & lngMyRow)
For lngMyRow = 2 To lngLastRow
'File name
fl = Range("B" & lngMyRow)
On Error Resume Next
FileCopy src & "\" & fl, dst & "\" & fl
Next lngMyRow
Application.ScreenUpdating = True
MsgBox "Done"
End Sub
Thanks and Regards!
Bookmarks