Hi
On Error Resume Next is bad becauase it does not solve any problem. It does not stop any error. It does not stop anything going wrong. It just ignores errors. The error is still there. But On Error Resume Next tells VBA not to tell you about the error, and not to stop the macro with an error message, but instead to keep running the macro even if there was an error.
Also, even if there are more errors, they will all be ignored.
So this may cause a big chaos because you will never know where or what went wrong.


Quote Originally Posted by fixer View Post
....
If ap.xls files is present then only this macro will work & if ap.xls file is not present then it should not do anything...
Probably you want something like we did here: https://excelfox.com/forum/showthrea...ory-to-another

One simpla way, would be to just Exit the Sub at the start of the macro , if the File is not present
Code:
Sub STEP12() '
    If Dir("C:\Users\WolfieeeStyle\Desktop\ap.xls", vbNormal) = "" Then Exit Sub




 
Or
Code:
Sub STEP12() '
    If Dir("C:\Users\WolfieeeStyle\Desktop\ap.xls", vbNormal) = "" Then MsgBox Prompt:="The file is not present": Exit Sub



 

Alan