+ Reply to Thread
Results 1 to 4 of 4

Copy data from multiple workbooks to a single workbook in another location using VBA

  1. #1
    Registered User
    Join Date
    04-27-2014
    Location
    Newcastle, England
    MS-Off Ver
    Excel 2007
    Posts
    23

    Copy data from multiple workbooks to a single workbook in another location using VBA

    Hi,

    I have a folder which contains multiple 'Customer' workbooks (example attachment 'Customer_001'). Each workbook has a filename unique to the customer (Customer_001, Customer_002, Customer_117 etc). The workbooks contain a single sheet with customer information and answers to questions. These 'Customer' workbooks are automatically saved into a folder once the customer completes a Userform and clicks 'save'. Potentially, there could be 100's of customers' workbooks saved in the folder, each with their own unique filename.

    I also have a 'Master' sheet saved in a different folder (example attachment 'Master'). The 'Master' workbook has multiple sheets named 'Department 1' and 'Department 2'. The purpose of the master sheet is to consolidate all information from the individual customers' workbooks.

    I've spent hours looking for some code that I can use/adapt to achieve the results I'm after but so far I've had no success.

    Specifically, I would like a command button on the 'Master' workbook to execute the following tasks...
    1. Copy the data from range A3:F3 from each of the 'Customer' workbooks held in the folder.
    2. Paste the data into the next blank row on the 'Department 1' sheet in the 'Master' workbook.

    3. Copy the data from range A7:F7 from each of the 'Customer' workbooks held in the folder.
    4. Paste the data into the next blank row on the 'Department 2' sheet in the 'Master' workbook.

    5. Save the 'Master' workbook.
    6. Delete all 'Customer' workbooks in the folder.

    Is this possible? And if so, would someone be kind enough to point me in the right direction or help me out with some VBA code please?

    Thanks in advance,
    Phil.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: Copy data from multiple workbooks to a single workbook in another location using VBA

    This should do it. I wouldn't recommend having the code delete the files, in case something goes wrong and you need a rerun. You can do it manually with a few clicks.

    Please Login or Register  to view this content.
    Last edited by natefarm; 06-11-2014 at 01:52 PM.
    Acts 4:12
    Salvation is found in no one else, for there is no other name under heaven given to mankind by which we must be saved.

  3. #3
    Registered User
    Join Date
    04-27-2014
    Location
    Newcastle, England
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Copy data from multiple workbooks to a single workbook in another location using VBA

    Natefarm,

    I can't thank you enough. You've nailed it in one take. This is exactly what I was looking for.

    If you ever come across the pond drop me a line & I'll buy you a pint.

    Cheers.

  4. #4
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: Copy data from multiple workbooks to a single workbook in another location using VBA

    Thanks for the offer!

+ 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. Replies: 0
    Last Post: 04-16-2013, 10:27 AM
  2. How to Copy Data from multiple workbooks to single workbook
    By Gautam Garg in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 07-23-2012, 04:17 PM
  3. [SOLVED] Copy from single workbook and past to multiple workbooks
    By Alby22 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-17-2012, 04:40 PM
  4. Copy data from multiple workbooks to a single master workbook
    By kishoremcp in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-11-2012, 03:44 AM
  5. macro to copy data from multiple workbooks in a single workbook
    By blyzzard in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-03-2011, 05:34 AM

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