Does anyone know of a way to loop a macro so it runs twice
D DNF Karran Aug 10, 2004 #3 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
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
H Harald Staff Aug 10, 2004 #4 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
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
P Peter Atherton Aug 10, 2004 #5 -----Original Message----- Does anyone know of a way to loop a macro so it runs twice? Click to expand... LB Look at the Do While method on Help. This will run until a condition is met. Regards Peter Atherton
-----Original Message----- Does anyone know of a way to loop a macro so it runs twice? Click to expand... LB Look at the Do While method on Help. This will run until a condition is met. Regards Peter Atherton