Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 26
Default Exit to the beginning of For Next loop

Hi,

For i=1 to 5
if .... then
....
....
GO TO THE BEGINNING OF FOR NEXT LOOP
end if
....
....
next i

What should I say to mean "GO TO THE BEGINNING OF FOR NEXT LOOP" above (if I
can).

Thanks and regards,

Cousin Excel


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Exit to the beginning of For Next loop

Hi,

In the If statement you can test for a condition then if satisfied exit the
for next loop

For i = 1 To 5
if my condition is met then
Exit For
End If

Next i
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"CousinExcel" wrote:

Hi,

For i=1 to 5
if .... then
....
....
GO TO THE BEGINNING OF FOR NEXT LOOP
end if
....
....
next i

What should I say to mean "GO TO THE BEGINNING OF FOR NEXT LOOP" above (if I
can).

Thanks and regards,

Cousin Excel


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Exit to the beginning of For Next loop

Sub demo()
For i = 1 To 5
v = Cells(i, 1).Value
If v 10 Then
Cells(i, 2).Value = "Big"
GoTo skiput
End If
Cells(i, 2).Value = "Little"
skiput:
Next i
End Sub

--
Gary''s Student - gsnu201003


"CousinExcel" wrote:

Hi,

For i=1 to 5
if .... then
....
....
GO TO THE BEGINNING OF FOR NEXT LOOP
end if
....
....
next i

What should I say to mean "GO TO THE BEGINNING OF FOR NEXT LOOP" above (if I
can).

Thanks and regards,

Cousin Excel


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 26
Default Exit to the beginning of For Next loop

Many thanks.
CousinExcel


"Gary''s Student" wrote:

Sub demo()
For i = 1 To 5
v = Cells(i, 1).Value
If v 10 Then
Cells(i, 2).Value = "Big"
GoTo skiput
End If
Cells(i, 2).Value = "Little"
skiput:
Next i
End Sub

--
Gary''s Student - gsnu201003


"CousinExcel" wrote:

Hi,

For i=1 to 5
if .... then
....
....
GO TO THE BEGINNING OF FOR NEXT LOOP
end if
....
....
next i

What should I say to mean "GO TO THE BEGINNING OF FOR NEXT LOOP" above (if I
can).

Thanks and regards,

Cousin Excel


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
Find loop doesn't loop JSnow Excel Discussion (Misc queries) 2 June 24th 09 08:28 PM
Exit Sub Jeff Excel Discussion (Misc queries) 2 March 1st 08 06:21 PM
Run when exit PH NEWS Excel Worksheet Functions 1 July 18th 06 03:53 PM
on exit macro ditchy Excel Discussion (Misc queries) 2 May 3rd 05 12:11 AM
exit excel welshwizzard Excel Discussion (Misc queries) 1 January 18th 05 12:02 AM


All times are GMT +1. The time now is 08:28 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"