Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 171
Default "Loop" to exit For loop?

I have a Macro that has a For..Next Loop in it which is (for now) 77 lines
long. Near the top there is a test which requires skipping most of the lines
and looping back to the top. At the moment I am doing this with a label
("NextWS:") parked right above the Next WS command.

In VFP programming there is a simple command ("Loop") which fires me back up
to the top immediately. However, according to the Help File for Excel I don't
see any such option. Is it legal to insert a "Next" command into the
eapression list that results from an If..End If test?

For a = 1 to 10
If a * myVar < 50 Then
Next a
Endif
<lines and lines of code
Next a
--
Dave
Temping with Staffmark
in Rock Hill, SC
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default "Loop" to exit For loop?

No command similar to loop that I am aware of.

for i = 1 to 10
if condition then


end if
Next

is the usual approach.

--
Regards,
Tom Ogilvy




"Dave Birley" wrote:

I have a Macro that has a For..Next Loop in it which is (for now) 77 lines
long. Near the top there is a test which requires skipping most of the lines
and looping back to the top. At the moment I am doing this with a label
("NextWS:") parked right above the Next WS command.

In VFP programming there is a simple command ("Loop") which fires me back up
to the top immediately. However, according to the Help File for Excel I don't
see any such option. Is it legal to insert a "Next" command into the
eapression list that results from an If..End If test?

For a = 1 to 10
If a * myVar < 50 Then
Next a
Endif
<lines and lines of code
Next a
--
Dave
Temping with Staffmark
in Rock Hill, SC

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 171
Default "Loop" to exit For loop?

I tried my little sample, and it returned the ol' "Next without For" error.
Just thought that someone would have thought of that approach. I mean, it
would save at least a pico-second in each iteration <g!
--
Dave
Temping with Staffmark
in Rock Hill, SC


"Tom Ogilvy" wrote:

No command similar to loop that I am aware of.

for i = 1 to 10
if condition then


end if
Next

is the usual approach.

--
Regards,
Tom Ogilvy




"Dave Birley" wrote:

I have a Macro that has a For..Next Loop in it which is (for now) 77 lines
long. Near the top there is a test which requires skipping most of the lines
and looping back to the top. At the moment I am doing this with a label
("NextWS:") parked right above the Next WS command.

In VFP programming there is a simple command ("Loop") which fires me back up
to the top immediately. However, according to the Help File for Excel I don't
see any such option. Is it legal to insert a "Next" command into the
eapression list that results from an If..End If test?

For a = 1 to 10
If a * myVar < 50 Then
Next a
Endif
<lines and lines of code
Next a
--
Dave
Temping with Staffmark
in Rock Hill, SC

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
Question on determining "ROW" inside of a "For .. RANGE " loop David Schrader[_2_] Excel Programming 2 January 3rd 07 08:18 PM
Find all cells NOT containing "100%" -no loop solution needed tskogstrom Excel Programming 2 November 25th 06 04:33 PM
Loop through ".DAT" files, open run code, close next Les Stout[_2_] Excel Programming 3 April 20th 06 10:15 AM
LOOP BETWEEN "FRONT" AND "END" SHEETS? ewan7279 Excel Programming 7 March 17th 05 03:11 PM
how to stop program with loop by click "Cancel" button miao jie Excel Programming 2 December 16th 04 02:42 PM


All times are GMT +1. The time now is 07:21 PM.

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

About Us

"It's about Microsoft Excel"