+ Reply to Thread
Results 1 to 3 of 3

VBA loop - when combining multiple WB some close after copy/paste but some stay open?

  1. #1
    Forum Contributor
    Join Date
    04-29-2010
    Location
    Tallahassee, FL
    MS-Off Ver
    365
    Posts
    100

    VBA loop - when combining multiple WB some close after copy/paste but some stay open?

    The code below works perfectly for what I need to do, which is to open and copy (or move) the first sheet of each of the workbooks in a single folder to a master WB that resides outside of that folder, then break the links to the source workbooks. However, every time I run the code, twenty-seven of the workbooks open and close before the next one opens (as they should), but the same five workbooks stay open after the code completes. The first sheet of each of these moves to the master WB like all the others, but they do not close after the move. I can't see any obvious difference between the WBs that stay open and the ones that close. Could someone please point me in the general direction of where the problem lies? I am using Excel 2007 but this needs to also run on 2003. Also, I am a beginner at vba. All of my code comes from forums and I tweak it enough to do what I need, so please excuse if it's "messy".
    Thanks!

    Here's the code:

    Please Login or Register  to view this content.
    Last edited by Royzer; 02-22-2012 at 11:26 AM.

  2. #2
    Registered User
    Join Date
    01-24-2012
    Location
    Swindon, England
    MS-Off Ver
    Excel 2003
    Posts
    21

    Re: VBA loop - when combining multiple WB some close after copy/paste but some stay o

    Is it anything to do with the number of sheets in the workbook. Moving the only sheet stops there being a workbook to see, moving one of a number of sheets means there is still a workbook to see

  3. #3
    Forum Contributor
    Join Date
    04-29-2010
    Location
    Tallahassee, FL
    MS-Off Ver
    365
    Posts
    100

    Re: VBA loop - when combining multiple WB some close after copy/paste but some stay o

    Thank you, Swindon! Works perfectly now!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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