Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
forgotten variations of loop
Hi i have always used the following loop statement in my code. Do ''stuff '' have a range setup set rng = rng.offset(1,0) Loop until rng = (some value such as 2004) I know that somehow you can loop until you find a certain value e.g 2003, perform the loop once more and then exit loop. This would avoid using the 'until' part and would benefit me more as not all of my sheets contain cells with 2004 in them. Just to give you a bit further background the loop copies and pastes raw data in certain columns until it reaches 2004 which is forecasted, however not all sheets/ranges need to contain forecasted data and thus have a column entitled 2004!! -- cereldine ------------------------------------------------------------------------ cereldine's Profile: http://www.excelforum.com/member.php...o&userid=32069 View this thread: http://www.excelforum.com/showthread...hreadid=543676 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
forgotten variations of loop
You can condition on the current cell at the top of the loop so that all 2003
gets processed and it quits before it processes 2004 Do while rng < 2004 set rng = rng.offset(1,0) Loop However, your original code would also perform that way. The next cell to be processed is checked at the bottom of the loop, so if that were 2004 it would quit. Perhaps you could be more specific about this particular situation and what you want to do. -- Regards, Tom Ogilvy "cereldine" wrote: Hi i have always used the following loop statement in my code. Do ''stuff '' have a range setup set rng = rng.offset(1,0) Loop until rng = (some value such as 2004) I know that somehow you can loop until you find a certain value e.g 2003, perform the loop once more and then exit loop. This would avoid using the 'until' part and would benefit me more as not all of my sheets contain cells with 2004 in them. Just to give you a bit further background the loop copies and pastes raw data in certain columns until it reaches 2004 which is forecasted, however not all sheets/ranges need to contain forecasted data and thus have a column entitled 2004!! -- cereldine ------------------------------------------------------------------------ cereldine's Profile: http://www.excelforum.com/member.php...o&userid=32069 View this thread: http://www.excelforum.com/showthread...hreadid=543676 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
matching 1 to 1 and 1 with variations... | Excel Worksheet Functions | |||
Many possible variations | Excel Worksheet Functions | |||
graphs with multiple variations | Excel Discussion (Misc queries) | |||
Variations on Sumif | Excel Worksheet Functions | |||
number variations | Excel Discussion (Misc queries) |