I am trying to learn loops.
My vba code is:
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
Selection.End(xlDown).Select
Selection.End(xlDown).Select
I would like to repeat this 5x
Or
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
Selection.End(xlDown).Select
Activecelloffset(0, -1) <<<<if this="" equals="" "x"="" then="" stop="" the="" loop,="" if="" not="" then
IF THIS CELL = "X" THEN STOP THE LOOP, IF NOT THEN . . .
Activecelloffset(0, 1) <<<< TO GET BACK TO WHERE WE LEFT OFF BEFORE TESTING
Selection.End(xlDown).Select
Then continue the loop until we find an "X"</if>
My vba code is:
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
Selection.End(xlDown).Select
Selection.End(xlDown).Select
I would like to repeat this 5x
Or
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
Selection.End(xlDown).Select
Activecelloffset(0, -1) <<<<if this="" equals="" "x"="" then="" stop="" the="" loop,="" if="" not="" then
IF THIS CELL = "X" THEN STOP THE LOOP, IF NOT THEN . . .
Activecelloffset(0, 1) <<<< TO GET BACK TO WHERE WE LEFT OFF BEFORE TESTING
Selection.End(xlDown).Select
Then continue the loop until we find an "X"</if>
Last edited: