Hello,
I have a code that opens each excel file in a folder, copies a range from that file and paste it on the other main file which I call consolidated database. This part of the code works fine, what is troubling me is that it only deletes all the file in that folder when the loop has been completed. Here's part of my current code that deletes all of them:
What I want to happen is to add a code to delete each file after it has been opened, information has been copied, and then pasted to database, and closed... just before opening another file. Reason is that when loop process fails sometime, it will not delete those files that have been recorded to my main database already, and I would have to manually check thousand of files, when I am processing a batch file for consolidation.
I hope my narration makes sense.
Many thanks in advance!
I have a code that opens each excel file in a folder, copies a range from that file and paste it on the other main file which I call consolidated database. This part of the code works fine, what is troubling me is that it only deletes all the file in that folder when the loop has been completed. Here's part of my current code that deletes all of them:
Sub
My Code here to open, copy, then paste...
Loop
Kill "C:\Users\[Redacted - My User ID]\OneDrive - [Redacted - My Company's Name]\Temp\*.xls"
End Sub
What I want to happen is to add a code to delete each file after it has been opened, information has been copied, and then pasted to database, and closed... just before opening another file. Reason is that when loop process fails sometime, it will not delete those files that have been recorded to my main database already, and I would have to manually check thousand of files, when I am processing a batch file for consolidation.
I hope my narration makes sense.
Many thanks in advance!