Loop macro

  • Thread starter Thread starter LB79
  • Start date Start date
If you add the following at the start and end of your code:

sub Loopy
for i = 0 to 1


Code
-------------------


next i
end sub

For more information look at the excel help- try searching for "Do Loop" and looking at "see also" for the various options you have.

Duncan
'excel.duncan-fiona.co.uk' (http://www.excel.duncan-fona.co.uk
 
Like this

Sub test()
Static N As Long
If N >= 2 Then Exit Sub
N = N + 1
MsgBox N
Call test
End Sub

but it's pretty silly. The usual and reasonalbe way is like this:

Sub main()
Call test2
Call test2
End Sub

Sub test2()
MsgBox "Yo"
End Sub

HTH. Best wishes Harald
 
-----Original Message-----
Does anyone know of a way to loop a macro so it runs twice?
LB

Look at the Do While method on Help. This will run until a
condition is met.

Regards
Peter Atherton
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Select drop down menu option using libre-calc macro 0
Looping Macros that change 1
Do loop 1
Loop 6
Looping Macro 1
Syntax for stopping a Do Loop? 5
Loop 1
reset the range of FOR loop 1

Back
Top