ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   On Error {...} Resume Next (https://www.excelbanter.com/excel-programming/356152-error-%7B-%7D-resume-next.html)

Edd[_2_]

On Error {...} Resume Next
 
Hello:

I want to use the On Error Resume Next statement to allow my code to
continue running but before the "Resume Next" part of the statement executes,
I would like some intermediate code to run first. So, upon an error, I would
like the main program to catch it, run some code, then resume program
execution with the statement following the error. How can I insert the
intermediate code?

Thanks,


Jim Thomlinson

On Error {...} Resume Next
 
You are looking for on error goto

sub whatever()
on error goto Errorhandler
'do some stuff

exit sub
ErrorHandler:
'do the error stuff
resume next
End sub

--
HTH...

Jim Thomlinson


"Edd" wrote:

Hello:

I want to use the On Error Resume Next statement to allow my code to
continue running but before the "Resume Next" part of the statement executes,
I would like some intermediate code to run first. So, upon an error, I would
like the main program to catch it, run some code, then resume program
execution with the statement following the error. How can I insert the
intermediate code?

Thanks,


Edd[_2_]

On Error {...} Resume Next
 
This is great!! Thank you Jim...



"Jim Thomlinson" wrote:

You are looking for on error goto

sub whatever()
on error goto Errorhandler
'do some stuff

exit sub
ErrorHandler:
'do the error stuff
resume next
End sub

--
HTH...

Jim Thomlinson


"Edd" wrote:

Hello:

I want to use the On Error Resume Next statement to allow my code to
continue running but before the "Resume Next" part of the statement executes,
I would like some intermediate code to run first. So, upon an error, I would
like the main program to catch it, run some code, then resume program
execution with the statement following the error. How can I insert the
intermediate code?

Thanks,



All times are GMT +1. The time now is 09:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com