PDA

View Full Version : Sequence two or more loops - VBA code



aaupg2323g
08-21-2008, 07:24 PM
Hi

I am new to the forum and request your help.

I have as many as 8 loops in vba which i would like to run in a sequence.

For example: I would like to run loop1 after the loop1 has completed the run immediately run the loop2 again once the loop2 has finished the run, immediately run the loop3 with out any break.

Something like:

Run Loop1
next Loop2
next loop3
next loop4
and so on for all the eight loops

Please help me with a vba code.

Thanks in advance

Gary

Simon Lloyd
08-21-2008, 08:23 PM
It's easily done, going on the information you gave:

Sub LoopIt ()
For Each Loop In Loops1
do something
Next Loop
For Each Loop2 In Loops1
do something
Next Loop2
For Each.........
.....etc
End Sub
You need to give more information, why not post your 8 loops or your entire code? we will be in a position to help you then!

Bob Phillips
08-22-2008, 01:01 AM
It sounds to me that you should setup a generic loop procedure, and than call it 8 times with the variable data as parameterised info.