+ Reply to Thread
Results 1 to 6 of 6

Loop for next

  1. #1
    Registered User
    Join Date
    09-28-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2010
    Posts
    57

    Loop for next

    Hi

    Can anyone help me with code to do loop for next

    I need to run the 18 times but after the first loop i need to call another macro then return back and loop the 2nd time.

    Kind Regards


    Penny

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Loop for next

    Penny,

    That's a really vague description. Here's some generic code that hopefully you can adapt:
    Please Login or Register  to view this content.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Valued Forum Contributor Miraun's Avatar
    Join Date
    04-03-2009
    Location
    New England
    MS-Off Ver
    2003, 2007, 2010, 2013
    Posts
    554

    Re: Loop for next

    Not 100% sure what you're asking for...
    Runs 18 times, then after the 18th time, runs a second macro?
    Runs 1 time, executes another macro, then runs 17 more times?
    Run 1 time, executes another macro, runs 1 more time, executes another macro, and this is repeated a total of 18 times?

    Side Note: Why are you executing another macro from within the macro... why not just have the entire macro self-contained within itself?

    If it's the latest:
    for i = 1 to 18
    Do stuff
    Call other macro
    Next i
    Going for Guru! Click the Star to the bottom left of this post if I helped!

  4. #4
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Loop for next

    Please Login or Register  to view this content.
    Gary's Student

  5. #5
    Registered User
    Join Date
    09-28-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2010
    Posts
    57

    Re: Loop for next

    Hi

    Thanks so far . My code looks in a table of 18 rows, it then opens the first file, then i need to run another macro to copy info into that file, then call another macro also that loops through another table of 18 rows oncw that is done it must loop from the beginning on row 2.

    Thanks Penny

  6. #6
    Registered User
    Join Date
    09-28-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2010
    Posts
    57

    Re: Loop for next

    Hi

    I have a workbook that has a table of 18 rows in it the loop goes to the first row and opens that file, then i need to run another macro to copy specfic info, then run another macro that has a different table also 18 rows it onpoens that file in the first row, once this is done i need it to return back and loop to the second row in the first file , and in the second macro.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1