Consulting

Results 1 to 3 of 3

Thread: Sequence two or more loops - VBA code

  1. #1

    Sequence two or more loops - VBA code

    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

  2. #2
    Moderator VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,003
    Location
    It's easily done, going on the information you gave:
    [vba]
    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
    [/vba]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!
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    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.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •