Loop Until and then once more

taltyr

New Member
Joined
Jul 20, 2011
Messages
31
I have written a macro that repeats a series of actions on a row and then drops down to the next row and repeats these actions (different variables though, so the actions are not a straight copy and paste). It loops until it comes to a blank cell in Column A.

What I would like it do, after it has reached the end of the loop cycle, is jump to another Cell/Row and repeat the actions once more.

In Code Terms it would be something like:

Code:
Do Until IsEmpty(ActiveCell)
 
  MsgBox (ActiveCell.Value)
 
  Cells(ActiveCell.Row, 1).Select
  ActiveCell.Offset(1, 0).Select
 
Loop
 
Range(Total).Select
Goto Code from Loop 'or something like that

There is a lot of code within the Loop and I Don't want to repeat it if I don't have to.

Regards

Rodger
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Hello,

I am thinking a counter could help...

<font face=Courier New><SPAN style="color:#00007F">Dim</SPAN> intCounter <SPAN style="color:#00007F">As</SPAN> interger<br>intCounter = 0<br><br>SecondLoop:<br><SPAN style="color:#007F00">'''loop here</SPAN><br><SPAN style="color:#007F00">'''end of loop</SPAN><br>intCounter = intCounter + 1<br><br>    <SPAN style="color:#00007F">If</SPAN> intCounter = 1 <SPAN style="color:#00007F">Then</SPAN><br>        <SPAN style="color:#00007F">GoTo</SPAN> DoneWithSecondLoop:<br>    <SPAN style="color:#00007F">Else</SPAN><br>        <SPAN style="color:#00007F">GoTo</SPAN> SecondLoop:<br>    <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br>    <br>DoneWithSecondLoop:<br><br><SPAN style="color:#007F00">'''continue code</SPAN></FONT>
 
Upvote 0

Forum statistics

Threads
1,215,633
Messages
6,125,922
Members
449,274
Latest member
mrcsbenson

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top