Hello,
I have some code that compares part of a filename to a list in a column then moves the file to a new folder if they match. However I can't seem to get the message boxes right. I want ONE message box to display "Files archived!" when the loop is finished and ALL the files have been moved, but also a msg box to display "File not found" when a file can't be found/doesn't match the list. I can only seem to get a message box to display after every file is moved so..20+ message boxes, or one at the very end regardless if anything has been moved or not
Here's (part) of my code:
Thanks!
I have some code that compares part of a filename to a list in a column then moves the file to a new folder if they match. However I can't seem to get the message boxes right. I want ONE message box to display "Files archived!" when the loop is finished and ALL the files have been moved, but also a msg box to display "File not found" when a file can't be found/doesn't match the list. I can only seem to get a message box to display after every file is moved so..20+ message boxes, or one at the very end regardless if anything has been moved or not
Here's (part) of my code:
Code:
For Each Objfile In objFolder.Files
FileNum = Left(Right(Objfile.Path, 13), 8)
Dim RowCount: RowCount = 2
Dim ColIndex: ColIndex = 16
Do
If Cells(RowCount, ColIndex).Value = FileNum Then
objFSO.MoveFile Objfile.Path, strFolderPath
End If
RowCount = RowCount + 1
Loop Until IsEmpty(Cells(RowCount, ColIndex).Value)
Next Objfile
Thanks!