+ Reply to Thread
Results 1 to 4 of 4

Copy Sheets from Closed Workbook into Open Active Workbook without linking

  1. #1
    Registered User
    Join Date
    11-03-2004
    Posts
    75

    Question Copy Sheets from Closed Workbook into Open Active Workbook without linking

    Need to copy Sheet1 and Sheet2 from a CLOSED workbook sitting on desktop called: "AR-template" into my OPEN/ACTIVE Workbook without linking. (and without messing up the formatting/column widths, etc.)
    C:/Users/brook/Desktop/AR-template

    Don't want to specifically hard-code in the name the open/active workbook because it will vary frequently...
    (as long as I make sure that's the only OPEN/ACTIVE workbook then it will be a safe copy/transfer)

    Note: the open/active workbook will not hold any duplicate tabs called "Sheet1" or "Sheet2" so there shouldn't be any conflicts during the copy.
    I guess it might be a good thing to have it do one of the following (if it accidentally found a duplicate when it was about to copy)
    (a) MsgBox: "Sheet1" already exists in destination file (OR--- EVEN BETTER THE NEXT ALTERNATIVE BELOW)
    (b) simply add the "(2)" like this: "Sheet1 (2)" and proceed w/ the copy without bothering w/ a msgbox.

    Position placement would be great if they can be placed at the far left (as the first 2 sheets) - but if not sure how to do that - that's fine, I can move them around manually after the copy takes place.

    Tried searching existing posts but the posts were either never answered w/ solutions or are different in need.
    Thanks in advance!
    Last edited by CHRISOK; 02-15-2018 at 11:44 PM. Reason: update regarding format retention

  2. #2
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Copy Sheets from Closed Workbook into Open Active Workbook without linking

    Perhaps a macro like this then may be of help?

    Please Login or Register  to view this content.
    I'm not sure of the file name (AR-template.xlsx) so you have to change that if this is false. The move command will delete the sheet1 and sheet2 from the "AR-template.xlsx" file but this does not matter as the line "ActiveWindow.Close SaveChanges:=False" will close the "AR-template.xlsx" without saving any changes so your original "AR-template.xlsx" will stay intact.

    ThisWorkbook is a command that refer to the workbook where you run this macro from so the name of this file does not matter. If ThisWorkbook only contains sheet3 and sheet4 it will after you run this macro contain sheets in this order Sheet2, Sheet1, Sheet3 and Sheet4.

    If this Workbook contains Sheet2 and Sheet3 it will after the macro is run contain Sheet2(2), Sheet1 and Sheet3.

    Alf

  3. #3
    Registered User
    Join Date
    11-03-2004
    Posts
    75

    Re: Copy Sheets from Closed Workbook into Open Active Workbook without linking

    That's it Alf! It worked!
    I had to change all the slashes to lean the opposite direction first -- but then it worked perfectly!
    "C:/Users/brook/Desktop/AR-template.xlsx" to "C:\Users\brook\Desktop\AR-template.xlsx"
    Thanks -- this is wonderful!
    REPUTATION kudos to you! Much appreciated!

  4. #4
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Copy Sheets from Closed Workbook into Open Active Workbook without linking

    Thanks for feedback and rep.

    Good that you spoted my mistake re slash and backslash. You know there are times where I'm really
    impressed by my own stupidity and this is one of those occasions..

    Alf

+ 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. [SOLVED] vba code to copy a specific sheet from a closed workbook to the active workbook
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-01-2017, 03:09 AM
  2. [SOLVED] vba copy all sheets from a closed workbook in a specified directory to active workbook
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-23-2017, 10:52 AM
  3. Open closed workbook, copy ranges from multiple sheets into an active Mastersheet
    By bgonen in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-05-2015, 08:01 AM
  4. [SOLVED] Code to copy data from a closed workbook and paste in active workbook using named range.
    By paullie1912 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-28-2014, 02:38 AM
  5. Run Macro in closed workbook and copy specific coloumn in active workbook
    By shiva_reshs in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-07-2013, 03:43 AM
  6. Copy 2 sheets from a open workbook and paste to a closed workbook
    By grimston in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-27-2012, 03:27 PM
  7. Linking between Active and Closed Workbook
    By Kenji in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-27-2009, 04:01 AM

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