#1
|
||||
|
||||
How to a For loop in VBA
In Visual Basic, the Continue statement will complete the current iteration of a loop and start the next, if any.
Code:
For i = 1 to 10 ...do some work If [some condition] then Continue For ...do the rest of the work Next i What's the proper way to end just the current iteration of a For loop in VBA without exiting the loop entirely (Exit Loop)? Is this different for VBA under Word vs under Excel? Last edited by Jennifer Murphy; 01-28-2013 at 11:02 PM. Reason: Fixed typo (End For) |
#2
|
|||
|
|||
Hi
Try: For i = 1 to 10 ...do some work If [some condition] then ...do the rest of the work Else Next i Good luck. Tony |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro to loop in Word | Yamaha Rider | Word VBA | 2 | 02-07-2012 05:33 PM |
How to use for loop in formula in VBA? | tinfanide | Excel Programming | 1 | 12-06-2011 08:33 AM |
While loop not working right | Cbrehm | Excel Programming | 0 | 05-11-2011 11:05 AM |
Continuous Loop | cksm4 | Word | 6 | 01-06-2011 09:03 PM |
Outlook 2003 restart in a loop | Stegel | Outlook | 0 | 06-29-2007 12:34 PM |