+ Reply to Thread
Results 1 to 11 of 11

Copying Specific Data from One Workbook and Pasting to Another

  1. #1
    Registered User
    Join Date
    01-31-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    6

    Copying Specific Data from One Workbook and Pasting to Another

    I am very new to this but I am trying to create a Macro that will copy specific data from multiple workbooks into a single "Master File" workbook.

    To be more specific, I have created a workbook with multiple sheets but one of the sheets tracks specific items in a given facitlity. I have 12 different people conducting the surveys and populating the sheet and saving it with their "zone number" in the file name. I want a macro that would run and copy the zone specific data from these other files and past it into my "Master File".

    I have been trying to understand and modify some things from other threads but have been unsuccessful. I have attached a very simplified version of my workbooks. Book1 would be for zone 1, Book2 for zone 2, etc. I would like to take that data for each zone from the respective workbook and get it copied and pasted into the BookMaster.

    I hope that makes sense and would appreciate any insight you can offer.
    Attached Files Attached Files

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

    Re: Copying Specific Data from One Workbook and Pasting to Another

    Would you intend the macro to open these files from a specific folder in your system?

    Should the data be copied one below the other in the same tab? Or should it be one tab for each zone?
    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
    Registered User
    Join Date
    01-31-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Copying Specific Data from One Workbook and Pasting to Another

    Yes, that would be fine.

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

    Re: Copying Specific Data from One Workbook and Pasting to Another

    Should the data be copied one below the other in the same tab? Or should it be one tab for each zone?

  5. #5
    Registered User
    Join Date
    01-31-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Copying Specific Data from One Workbook and Pasting to Another

    One below the other in the same tab.

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

    Re: Copying Specific Data from One Workbook and Pasting to Another

    Considering that there are a standard number of 4 entries per file, you can use this code.
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    01-31-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Copying Specific Data from One Workbook and Pasting to Another

    Sorry, that was just my example. Every file has a different number of entries ranging from 20 - 45 or so? What would I need to change?

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

    Re: Copying Specific Data from One Workbook and Pasting to Another

    Hmmm ok, i need to change the logic a bit. Give me sometime and i will give you a revised code. It would have been good if you had mentioned this in your sample data. But i understand, you are new to the forum. Will be back in a few mins.

  9. #9
    Registered User
    Join Date
    01-31-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Copying Specific Data from One Workbook and Pasting to Another

    I'm very sorry that was my mistake! Please accept my apology. I truly appreciate the assistance you have already provided!

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

    Re: Copying Specific Data from One Workbook and Pasting to Another

    When you are working with your original file, will you be populating columns A & B of your BookMaster? I would say, to save you the trouble of counting how many rows are there in each Zone file, and then creating the lines in the BookMaster, its more efficient if the macro does it for you.
    The macro will be able to identify which workbook the data comes from (i will use the number of the book, for e.g. the 2 from Book2. It will work even if you change the book name to "Zone2").

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

    Re: Copying Specific Data from One Workbook and Pasting to Another

    Use this updated code -
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    01-31-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Copying Specific Data from One Workbook and Pasting to Another

    This works very well with one file but once I put multiple files in the folder it doesn't work as desired. It appears to be writing the data over top of each other. Is there a way to make it write to the next blank row? Also, something strange happens with the column "A" output but I'm no sure how to describe that yet. It may fix itself one the rows write to the correct location. Thanks again for all your help!

+ 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