Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default skip to next from if

I have several If statements inside a for....next loop, how do I
skip to next when an if condition is met?

For some condition

if a condition is met then
skip to next
end if

if...
something here
end if

if ...
something here
end if

next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 417
Default skip to next from if

Label the Next statement at the bottom of the loop (be sure to include
the colon after the label):

For index = StartValue to EndValue
If Condition1 then goto NextLoop
If Condition2 then goto NextLoop
If Condition3 then goto NextLoop
DoSomethingIfAllConditionsAreFalse
NextLoop:
Next index

Even if you tab in to enter the statement label ("NextLoop" in this
case), Excel will outdent the label to column 1 after you finish
entering the statement (when you press Enter).

--
Regards,
Bill Renaud



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
Skip weekends rhhince[_2_] Excel Worksheet Functions 1 October 12th 09 12:12 AM
using IF to skip Julie Excel Worksheet Functions 4 March 14th 08 10:21 PM
If Cannot find skip??? [email protected] Excel Programming 2 December 1st 06 09:54 AM
Skip over a particular error Helen Excel Programming 2 August 1st 06 04:21 PM
Skip a day of the week Flintstone Excel Discussion (Misc queries) 4 June 6th 05 02:31 PM


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