+ Reply to Thread
Results 1 to 11 of 11

Copy sheet from one workbook to another

  1. #1
    Forum Contributor
    Join Date
    03-03-2011
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    123

    Copy sheet from one workbook to another

    Hi there,

    I have made a drawing Issue template, and the first Beta is already released.
    However, I have made a updated version, and I would like to have a easy way to update to the newer version.

    For example, I have Workbook1.1 withs Sheets A, B,C and D
    Now the newer version is Workbook 1.2 With Sheets A,B,C,D and E.

    However, the data is actually only stored in Sheets B,C and D in both the workbooks, with no changes at all.

    I would like to have a macro in Workbook 1.2 that can copy the entire sheets B,C and D from workbook 1.1 to sheets B,C and D in Workbook 1.2

    Note, the workbooks will not necessarily be in the same folder or location.

    Is that possible, and if so, how?

    Best Regards,

    Jakes
    Last edited by Jakes; 02-29-2012 at 10:20 AM.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Copy sheet from one workbook to another

    This is one way. Put this code in a blank module of workbook 1.2
    Please Login or Register  to view this content.
    You can then delete any unwanted sheets.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Forum Contributor
    Join Date
    03-03-2011
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    123

    Re: Copy sheet from one workbook to another

    Awesome, it is more or less what I was looking for. It works fine, but it does not place the content in the same sheet name, but make a new sheet , leaving the existing one blank. The Sheets MUST be the same name for the forms to work.
    Can the above code be adjusted so it replace the current sheet with the new imported one, keeping the same name?

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Copy sheet from one workbook to another

    Ok that can be done. Can you provide me the exact names of your sheets (if they are not B,C & D) so that you do not have to change them at your end again?

  5. #5
    Forum Contributor
    Join Date
    03-03-2011
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    123

    Re: Copy sheet from one workbook to another

    Cool stuff!

    The sheet names are "Issues", "Drawings", "ProjectInfo", "Participants"

    Here are the code adapted to work with my sheet names:

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    03-03-2011
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    123

    Re: Copy sheet from one workbook to another

    Ok I have implemented the code below, and it work sort off.

    First I use this code to delete the current sheets:

    Please Login or Register  to view this content.
    Then I use this code to import the sheets from a previous version:

    Please Login or Register  to view this content.
    My problem is however, non of my VLookup formulas work after importing, it does not recognise the new imported sheets, although it have the same name. Is there somewhere something I need to update or refresh?
    Cheers,

    Jakes

  7. #7
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Copy sheet from one workbook to another

    So all 4 sheets - Issues, Drawings, ProjectInfo & Participants should be copied over from 1.1 to 1.2?

  8. #8
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Copy sheet from one workbook to another

    What do your vlookup formulae show? Some error as the result?

    If the above method does not work, we can have a code that will replace the contents of the sheets in 1.2 instead of copying over the sheets.

  9. #9
    Forum Contributor
    Join Date
    03-03-2011
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    123

    Re: Copy sheet from one workbook to another

    Yes
    Attached are the workbook for reference. Use the Import data button on the Help sheet

    Issue slip Template v1.3.xlsm

  10. #10
    Forum Contributor
    Join Date
    03-03-2011
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    123

    Re: Copy sheet from one workbook to another

    Quote Originally Posted by arlu1201 View Post
    What do your vlookup formulae show? Some error as the result?

    If the above method does not work, we can have a code that will replace the contents of the sheets in 1.2 instead of copying over the sheets.
    everywhere the sheet names should be, I get a #REF! for example =VLOOKUP(P16,#REF!,2,FALSE)

  11. #11
    Forum Contributor
    Join Date
    03-03-2011
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    123

    Re: Copy sheet from one workbook to another

    Yes I guess the best is to copy the contents instead of the whole sheet. My Excel VBA is just so limited, I do not know how

  12. #12
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Copy sheet from one workbook to another

    This is the updated code that you can use -
    Please Login or Register  to view this content.
    Also i observed that your file has lots of modules. You can remove most of them which you do not need and even have multiple code subs in the same module. It will help to keep your file better organized.

+ 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