+ Reply to Thread
Results 1 to 10 of 10

Copy from one workbook and Paste in New TAB of Master workbook

  1. #1
    Registered User
    Join Date
    08-27-2012
    Location
    raleigh, nc
    MS-Off Ver
    Excel 2007
    Posts
    13

    Copy from one workbook and Paste in New TAB of Master workbook

    I have a workbook that is tracking whether something was completed. Then I need to put into a "master" workbook. I want to copy the data from workbook "A", Paste that data in MASTER but in a new tab called "A" All files are located in the same network directory. I have the open, save and close programming. I am having problems "creating" the new tabs.

    Please Login or Register  to view this content.
    Thank you for all assistance.

  2. #2
    Forum Contributor
    Join Date
    09-22-2012
    Location
    Berkeley, CA
    MS-Off Ver
    Excel 2010
    Posts
    112

    Re: Copy from one workbook and Paste in New TAB of Master workbook

    Try adding this into the loop:

    Please Login or Register  to view this content.
    ------------------------
    W2

  3. #3
    Registered User
    Join Date
    08-27-2012
    Location
    raleigh, nc
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Copy from one workbook and Paste in New TAB of Master workbook

    Ok...I added

    Please Login or Register  to view this content.
    Following happened: It opened the workbook, moved the data from workbook(1), copied and saved the data from workbook(2) over top of the workbook(1) data and then failed on the statement:

    Please Login or Register  to view this content.
    Addition information: The workbooks that are being opened, copied, saved, and then closed will each need their own separate worksheet. I am thinking I am going to need a "for loop" to make this happen, or is there a simpler way to Open the workbook, copy the data, paste the data in its own worksheet on the "master workbook", save the opened workbook, and then finally close the workbook?
    Last edited by AutoCAD Guy; 01-14-2013 at 03:08 PM.

  4. #4
    Forum Contributor
    Join Date
    09-22-2012
    Location
    Berkeley, CA
    MS-Off Ver
    Excel 2010
    Posts
    112

    Re: Copy from one workbook and Paste in New TAB of Master workbook

    Can you attach the workbooks, and I'll try it on my machine?

  5. #5
    Registered User
    Join Date
    08-27-2012
    Location
    raleigh, nc
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Copy from one workbook and Paste in New TAB of Master workbook


  6. #6
    Forum Contributor
    Join Date
    09-22-2012
    Location
    Berkeley, CA
    MS-Off Ver
    Excel 2010
    Posts
    112

    Re: Copy from one workbook and Paste in New TAB of Master workbook

    Try getting rid of

    Please Login or Register  to view this content.
    I think what is happening is that the move statement removes all data from the source workbooks, and it becomes empty. Since the workbook is empty, the save and close statements fail.

    The way the code is written, it will automatically create a new worksheet for the data being copied. One sheet for each file. There is really no need to save the files since you're just copying and pasting from them.

    Let me know if this fixes the issue.

  7. #7
    Registered User
    Join Date
    08-27-2012
    Location
    raleigh, nc
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Copy from one workbook and Paste in New TAB of Master workbook

    Thank you very much.

    this worked just fine...no more errors YAY

  8. #8
    Forum Contributor
    Join Date
    11-05-2012
    Location
    Montreal
    MS-Off Ver
    Excel 2007
    Posts
    107

    Re: Copy from one workbook and Paste in New TAB of Master workbook

    Hello AutoCad,

    Can you please put the excel worksheet with the working vba. It would be really helpful.

    Thank you

  9. #9
    Forum Contributor
    Join Date
    09-22-2012
    Location
    Berkeley, CA
    MS-Off Ver
    Excel 2010
    Posts
    112

    Re: Copy from one workbook and Paste in New TAB of Master workbook

    It's the same as the other worksheet, just remove the two lines from the code.

  10. #10
    Registered User
    Join Date
    08-27-2012
    Location
    raleigh, nc
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Copy from one workbook and Paste in New TAB of Master workbook

    Please Login or Register  to view this content.

    this is the working code only thing is, if you leave everything in the directory you will continually paste the "old" files to the master workbook...

+ 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