Re: "Loop" to exit For loop?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



would this work?
if it's less than 50, it would do nothing, and skip all the other
coding, going directly to "next a".
? just an idea

For a = 1 to 10
If a * myVar < 50 Then
'do nothing
Else
<lines and lines of code>
End if
Next a

susan



On May 24, 1:35 pm, Dave Birley <DaveBir...@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:
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- Hide quoted text -

- Show quoted text -


.



Relevant Pages

  • RE: Practical Macro Size Limit?
    ... "Dave Birley" wrote: ... Temping with Staffmark ... in Rock Hill, SC ...
    (microsoft.public.excel.programming)
  • RE: Practical Macro Size Limit?
    ... If I park my sub-procedures in the same Module, ... Temping with Staffmark ... in Rock Hill, SC ...
    (microsoft.public.excel.programming)
  • RE: Personal.XLS Prob.
    ... Temping with Staffmark ... in Rock Hill, SC ... "Tom Ogilvy" wrote: ... macro name, not in the same format as using call. ...
    (microsoft.public.excel.programming)
  • Re: Practical Macro Size Limit?
    ... how do I initiate a new Module to stash my sub-Procedures? ... Temping with Staffmark ... in Rock Hill, SC ...
    (microsoft.public.excel.programming)
  • Re: Practical Macro Size Limit?
    ... Temping with Staffmark ... in Rock Hill, SC ... myResult As Boolean) As Long ...
    (microsoft.public.excel.programming)