Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 168
Default On Error reset?

I'm using the On Error Goto code (see below).

On Error GoTo StopError

The StopError routine is as follows:

StopError:
Msg = "There appears to be no data for this model. (" & model & ")
Click OK to continue and then verify that there were no calls for that
particular model last month." ' Define message.
Style = vbOKOnly ' Define buttons.
Title = model ' Define title.
Response = MsgBox(Msg, Style, Title)
GoTo Repeat


This macro loops several times. Each time, I need to be able to keep the
"On Error GoTo StopError" active. For some reason, the second time an error
occurs, I just get the error instead of the code re-routing to the StopError
routine. I've tried adding "On Error Goto 0" before the "GoTo Repeat"
statement with no success.

Any ideas?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default On Error reset?


GoTo doesn't deactivate an error handler. Change the last line in your
error handler to:

Resume Repeat

Resume deactivates the error handler and branches code execution to the line
specified by the label.

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"PCLIVE" wrote in message
...
I'm using the On Error Goto code (see below).

On Error GoTo StopError

The StopError routine is as follows:

StopError:
Msg = "There appears to be no data for this model. (" & model & ")
Click OK to continue and then verify that there were no calls for that
particular model last month." ' Define message.
Style = vbOKOnly ' Define buttons.
Title = model ' Define title.
Response = MsgBox(Msg, Style, Title)
GoTo Repeat


This macro loops several times. Each time, I need to be able to keep the
"On Error GoTo StopError" active. For some reason, the second time an

error
occurs, I just get the error instead of the code re-routing to the

StopError
routine. I've tried adding "On Error Goto 0" before the "GoTo Repeat"
statement with no success.

Any ideas?




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 168
Default On Error reset?

Thanks, that works great!


"Rob Bovey" wrote in message
...

GoTo doesn't deactivate an error handler. Change the last line in your
error handler to:

Resume Repeat

Resume deactivates the error handler and branches code execution to the

line
specified by the label.

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"PCLIVE" wrote in message
...
I'm using the On Error Goto code (see below).

On Error GoTo StopError

The StopError routine is as follows:

StopError:
Msg = "There appears to be no data for this model. (" & model & ")
Click OK to continue and then verify that there were no calls for that
particular model last month." ' Define message.
Style = vbOKOnly ' Define buttons.
Title = model ' Define title.
Response = MsgBox(Msg, Style, Title)
GoTo Repeat


This macro loops several times. Each time, I need to be able to keep

the
"On Error GoTo StopError" active. For some reason, the second time an

error
occurs, I just get the error instead of the code re-routing to the

StopError
routine. I've tried adding "On Error Goto 0" before the "GoTo Repeat"
statement with no success.

Any ideas?






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tab Key reset DKSteph Excel Worksheet Functions 2 March 20th 09 07:20 PM
How do I reset the tab key? Saeanen Excel Discussion (Misc queries) 2 May 22nd 07 04:26 PM
Reset Counter Ed Excel Discussion (Misc queries) 3 April 14th 06 05:35 PM
using % button gives error "percent style not found" Can I reset? Light Excel Discussion (Misc queries) 3 March 16th 06 12:18 PM
reset to zero baldyheed Excel Worksheet Functions 3 October 2nd 05 03:30 AM


All times are GMT +1. The time now is 11:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"