vba on error resume
' Example of resume after an error
Private Sub TestMe()
Dim m As New Collection
On Error GoTo CleanFail
Debug.Print 1 / 0
CleanExit:
Set m = Nothing
Debug.Print "Clean exit"
Exit Sub
CleanFail:
Debug.Print Err.Description
Err.Clear
Resume CleanExit
End Sub