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

If I exit a loop do to an error (On Error) can I then direct control back
into the loop via a GoTo?

e.g.

On Error GoTo EndofProc

For i = 0 to n
Resume:
' do stuff
Next i

Exit Sub

EndofProc:
i = i + 1
GoTo Resume


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default On Error and Loops

one way:

On Error GoTo EndofProc
For i = 0 To n
'Do Stuff
Continue:
Next i
Exit Sub
EndofProc:
'do error stuff
Resume Continue
End Sub


In article ,
"ThisShouldBeEasy" wrote:

If I exit a loop do to an error (On Error) can I then direct control back
into the loop via a GoTo?

e.g.

On Error GoTo EndofProc

For i = 0 to n
Resume:
' do stuff
Next i

Exit Sub

EndofProc:
i = i + 1
GoTo Resume

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
For next loops Kate Excel Discussion (Misc queries) 5 May 22nd 06 01:11 PM
Using For - Next Loops in VB Biomed New Users to Excel 1 March 21st 05 09:35 PM
Error Handling with Nested Loops Ctal Excel Programming 3 September 22nd 04 03:00 AM
Error Handling and For-Next Loops SuperJas Excel Programming 2 May 28th 04 07:41 AM
help with loops Rick B[_6_] Excel Programming 8 January 28th 04 12:32 AM


All times are GMT +1. The time now is 02:50 PM.

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"