+ Reply to Thread
Results 1 to 6 of 6

Restart Sub when Finished

  1. #1
    Forum Contributor
    Join Date
    10-11-2013
    Location
    Austria
    MS-Off Ver
    Excel 2010
    Posts
    136

    Restart Sub when Finished

    I'm copying info from about 2000 Sheets in around 200 Workbooks, and lazy as I am, rather that pressing 2 keys (I'm using ALT+1 to run the macro at the moment) to start the process for each sheet I'd like it to run the Sub then restart.
    The code starts in the worksheet(W1) where I copy the info from, copys it, pastes it in the other workbook(W2), closes W1 and opens the next W1 from a list of links in W2.
    Then stops.
    how can I make the whole process start again automatically?

    Here's the code (messy as it is..)

    Please Login or Register  to view this content.
    Last edited by rodgersmg; 05-08-2015 at 03:02 AM. Reason: Reformat

  2. #2
    Forum Expert
    Join Date
    06-26-2010
    Location
    Austin, TX
    MS-Off Ver
    Excel 2010
    Posts
    1,673

    Re: Restart Sub when Finished

    Just wrap the entire code into a Do...While True loop. It would never end - but is that really what you want?
    Pauley
    --------
    If I helped with your issue, I'd appreciate a rep bump (hit the '*' icon to the bottom left of this post).

  3. #3
    Forum Contributor
    Join Date
    10-11-2013
    Location
    Austria
    MS-Off Ver
    Excel 2010
    Posts
    136

    Re: Restart Sub when Finished

    Sorry, I'm new to Loops, how would that look?
    It Kind is what I want, because eventually at the end it would hit an error because there would be no new link to open. I guess..

  4. #4
    Valued Forum Contributor
    Join Date
    08-22-2011
    Location
    Auckland
    MS-Off Ver
    Excel 2019
    Posts
    716

    Re: Restart Sub when Finished

    Hi rodgersmg
    Something like this example. You know where the code starts & finishes for each worksheet.
    I hope the little piece of code below isn't as clear as mud

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    10-11-2013
    Location
    Austria
    MS-Off Ver
    Excel 2010
    Posts
    136

    Re: Restart Sub when Finished

    Thanks Phil, that did the trick.
    Change the order of things and added some error handnling so it jumps out when I Need it too.

  6. #6
    Valued Forum Contributor
    Join Date
    08-22-2011
    Location
    Auckland
    MS-Off Ver
    Excel 2019
    Posts
    716

    Re: Restart Sub when Finished

    That's good & glad it was an easy fix

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Userform restart after end sub
    By Sibrulotte in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-13-2011, 02:34 PM
  2. Re: 'Do Until...' Restart
    By Jack in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-22-2006, 04:10 AM
  3. [SOLVED] Re: 'Do Until...' Restart
    By Jack in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-21-2006, 12:32 PM
  4. 'Do Until...' Restart
    By Jack in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-21-2006, 11:10 AM

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