Try
Public Sub copyImageFiles()
On Error Resume Next
'##
'## declare
'##
Dim rowNumber As Long
Dim objFSO As Object
'##
'## freeze interfaces updates for performance reasons
'##
Application.ScreenUpdating = False
'##
'## initialise
'##
Set objFSO = CreateObject("Scripting.FileSystemObject")
'##
'## loop for all rows on the active worksheet and copy the image object from the source to the target
'## folder - if the copy operation returns an error the file did not exist - use objFSO.MoveFile to actually move
'## the image object
'##
With ThisWorkbook.ActiveSheet
For rowNumber = 2 To .Cells(1, "A").End(xlDown).Row
objFSO.CopyFile "D:\www\mywebsite.uk\image\data\" & .Cells(rowNumber, "B").Value, "D:\www\mywebsite.uk\image\data\filesfound\"
If Err.Number <> 0 Then
.Cells(rowNumber, "AA") = "No"
Else
.Cells(rowNumber, "AA") = "Yes"
End If
Next rowNumber
End With
'##
'## unfreeze interfaces updates for performance reasons
'##
Application.ScreenUpdating = True
End Sub
Bookmarks