Hi all,
May I have your help to add below functions to the vba please?
1. if source or destination folder do not exist, column D will remark" no source / destination file found".
2. For other situations, when a file was copied successfully, the corresponding cell in column D will automatically remark " transferred", however, when copy failed, the corresponding cell in column D will automatically remark "failed"
3. Where should I put on error resume next if I want the program to run through the last row?
tab1.JPG
****************************************
Dim fso
Dim source_file As String
Dim source_folder As String
Dim destination_folder As String
Dim lastrow As Integer
lastrow = ActiveSheet.UsedRange.Rows.Count
For i = 2 To lastrow
source_file = Cells(i, "a")
source_folder = Cells(i, "b")
destination_folder = Cells(i, "c")
Set fso = CreateObject("scripting.filesystemobject")
fso.CopyFile (source_folder & source_file), destination_folder, True
Cells(i, "d") = "successfully transferred"
Next i
End Sub
*******************************************
Bookmarks