Hi All,
Here is an example of a procedure I have set-up:-
I know that on a particular occasion, the line Selection.SpecialCells(xlCellTypeBlanks).Select could error out so I need the code to resume at label Continue.
However, at the beginning of the procedure I have a general ONERROR statement which will exit the sub – detailing the error in a message box.
I can’t figure out how to retain the original ONERROR trap if the code should falter at Selection.SpecialCells(xlCellTypeBlanks).Select.
I have placed ONERROR GOTO 0 just after the Continue label but this seems to disable all error traps.
Thanks in advance,
Paul.
Here is an example of a procedure I have set-up:-
Code:
Sub Start()
OnError GOTO End_
Code Blah Blah Blah
Code Blah Blah Blah
OnError GOTO Continue
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.FormulaR1C1 = "=R[-1]C"
Columns("A:A").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Continue:
Code Blah Blah Blah
Code Blah Blah Blah
Exiit Sub
End_:
Msgbox Err.Number & Err.Description
End Sub
I know that on a particular occasion, the line Selection.SpecialCells(xlCellTypeBlanks).Select could error out so I need the code to resume at label Continue.
However, at the beginning of the procedure I have a general ONERROR statement which will exit the sub – detailing the error in a message box.
I can’t figure out how to retain the original ONERROR trap if the code should falter at Selection.SpecialCells(xlCellTypeBlanks).Select.
I have placed ONERROR GOTO 0 just after the Continue label but this seems to disable all error traps.
Thanks in advance,
Paul.