Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have the following loop:
for each cell in selection ' n-by-m area if 'condition based on cell.value' then cell.entireRow.delete else ' process cell end if next As written, if the range is A1:B10 and A2 meets the condition, the loop continues by processing (the new) B2 after deleting row 2 -- which means that the new A2 is never processed. Is there an easy way to continue the loop by processing (the new) A2 after deleting row 2? I work around the problem by adding "goto again" after the entireRow.delete operation, where "again" is above the for-each statement. That is, I restart the for-loop. That is okay for now because with my data, I only delete one row near the top of the selection. Thus, I lose little efficiency. But I would like to know the "right" way to do this, for the future. (I tried putting "again" at the top of loop just after the for-each statement, but I got a debug error because "cell" is apparently undefined after the deletion.) |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
to continue down in the same row | Excel Discussion (Misc queries) | |||
Continue | Excel Programming | |||
Deleting rows loop | Excel Programming | |||
continue statement in a loop | Excel Programming | |||
deleting rows, endless loop maybe ? | Excel Programming |