Question: Through some research and trial and error, I was able to come across this basic VBA that is helping me rename a large list of file attachments. I have been able to rename a few dozen attachments but I run into the run-time error '53: File Not Found.' Is there a way to modify the VBA to skip over the file names that cannot be found?

```
Sub RenameFiles()
Const strPath = "C:\Documents and Settings\User\My Documents\FolderName\"
Dim r As Long
Dim n As Long
n = Cells(Rows.Count, 1).End(xlUp).Row
For r = 2 To n
Name strPath & Cells(r, 1) As strPath & Cells(r, 2)
Next r
End Sub

```

Answer: 
Error handling is disabled with this statement:

```
On Error Resume Next

```

To enable error handling again you have to use this statement:

```
On Error Goto 0

```

It's good practice to disable error handling only for the statements where you realy want to skip the error. On the other side enabling and disabling the error handling may slow doen your code. In that case you can place it arount the loop.

```
On Error Resume Next
For r = 2 To n
  Name strPath & Cells(r, 1) As strPath & Cells(r, 2)
Next r
On Error Goto 0

```
Add the following line at the top of your subroutine:

```
On Error Resume Next

```

This statement does exactly what it says, it ignores the error and moves on to the next line of code.

You need to **use caution** when using this statement as it does not fix the error. For your current issue, it should be fine, but in many others you'll need to handle the error instead of ignoring it.

A good resource to get the basics is [Error Handling in VBA](http://www.cpearson.com/excel/errorhandling.htm).

If you want to learn more about Excel VBA, brettdj's answer to [What is the best way to master VBA macros](https://stackoverflow.com/a/7524173/138938) is a great place to start.

To see how errors are affected by `On Error Resume Next` or `On Error GoTo 0`, step through the following in your VBA Editor:

```
Sub ExcelVBAErrorDemo()

    Dim forceError As Integer

    ' ignore errors
    On Error Resume Next
    ' cause an error
    forceError = 1 / 0

    ' the error was ignored, and the integer variable will
    ' display its default value
    MsgBox "Our forceError variable = " & forceError

    ' turn default error handling behavior back on
    On Error GoTo 0
    ' now we'll get a run-time error
    forceError = 1 / 0

End Sub

```