+ Reply to Thread
Results 1 to 8 of 8

Copy Range from multiple Workbooks in folder, to Summary Workbook also in same folder?

  1. #1
    Forum Contributor
    Join Date
    03-21-2013
    Location
    USA
    MS-Off Ver
    365
    Posts
    163

    Question Copy Range from multiple Workbooks in folder, to Summary Workbook also in same folder?

    Hello,

    I have a folder with an unlimited amount of workbooks in it which each contain a range of data.
    This data resides on the same sheet for each workbook. This sheet in each workbook is labeled "Summary".
    On the "Summary" sheet, the data needed resides from cell ("A3:G?").
    The data begins on "A3", and ends on column "G" one row up from the last row with data in it.

    What I would like to do it grab this data from each Workbook in this folder, within that range, and paste it into another Workbook in that same folder.
    We can call this new Workbook the "Master Summary" workbook.
    I need this newly copied data in the "Master Summary" workbook to begin it's pasting at cell ("A3").

    I'm imagining that I will assign this macro to a button which will execute the extracting of the data from each workbook into the "Master Summary" workbook.

    Also, need to keep in mind that new Workbooks will be added to this folder continuously, so this code would need to be able to constantly include newly added Workbooks.

    Anybody have any ideas on how I can start this?

    Thank you for your help and advice in advance!

    -Mike in Cali
    Last edited by xlyfe; 08-23-2018 at 01:27 PM.

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Copy Range from multiple Workbooks in folder, to Summary Workbook also in same folder?

    This is so easy to achieve with Power Query (Get & Transform Data). Something like:

    Combine Files:
    Please Login or Register  to view this content.

    fnEachFileContents:
    Please Login or Register  to view this content.
    Last edited by Olly; 08-23-2018 at 12:29 PM. Reason: Added line to keep only first 7 columns
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Forum Contributor
    Join Date
    03-21-2013
    Location
    USA
    MS-Off Ver
    365
    Posts
    163

    Re: Copy Range from multiple Workbooks in folder, to Summary Workbook also in same folder?

    Quote Originally Posted by Olly View Post
    This is so easy to achieve with Power Query (Get & Transform Data). Something like:

    Combine Files:
    Please Login or Register  to view this content.

    fnEachFileContents:
    Please Login or Register  to view this content.
    So I'm not too fluent with this Power Query Editor. I have two questions.

    1) Am I creating 2 separate queries with this code of yours?

    2) The first one, "Combine Files", is giving me an (Expression.SyntaxError: Token Comma expected.). And it's highlighted the (#"Get Files Contents") as the root of the error. I'm attempting to troubleshoot this at the moment, but being that I'm very new to Power Query Editor, I'm having some difficulty.

    Thank you so much for you help Olly.

  4. #4
    Forum Contributor
    Join Date
    03-21-2013
    Location
    USA
    MS-Off Ver
    365
    Posts
    163

    Re: Copy Range from multiple Workbooks in folder, to Summary Workbook also in same folder?

    I'm trying to figure out this Power Query thing and I just don't see how it's going to be easier for me to manage as VBA would be. Currently I'm stumped.

  5. #5
    Forum Contributor
    Join Date
    03-21-2013
    Location
    USA
    MS-Off Ver
    365
    Posts
    163

    Re: Copy Range from multiple Workbooks in folder, to Summary Workbook also in same folder?

    Yeah. I'm still not figuring out this Power Query.

    Anybody else out there know how I can achieve what I'm trying to do with VBA?

    Any advice or guidance is greatly appreciated.

  6. #6
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Copy Range from multiple Workbooks in folder, to Summary Workbook also in same folder?

    See attached workbook for a working example.

    Change the path reference from "C:\Temp\Source" to your required path. If there are other files in that folder, as well as the ones you wish to combine, then you may need to apply a filter, to choose only the excel files to combine, before you apply the function.

    It's worth taking a little time to understand how Power Query works - for performance, reliability and simplicity of data handling, it's way easier than VBA.

    In this case, to update your data, simply refresh the query.
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    03-21-2013
    Location
    USA
    MS-Off Ver
    365
    Posts
    163

    Re: Copy Range from multiple Workbooks in folder, to Summary Workbook also in same folder?

    Quote Originally Posted by Olly View Post
    See attached workbook for a working example.

    Change the path reference from "C:\Temp\Source" to your required path. If there are other files in that folder, as well as the ones you wish to combine, then you may need to apply a filter, to choose only the excel files to combine, before you apply the function.

    It's worth taking a little time to understand how Power Query works - for performance, reliability and simplicity of data handling, it's way easier than VBA.

    In this case, to update your data, simply refresh the query.
    Hello Olly,

    Thank you sooooo much for introducing me to this part of Excel. After studying up on it for the past few hours and putting it to the test, I can't believe that I have lived without it for this long.

    You are correct that it is very easy to use once given proper time to learn it.

    I solved my problem that I was asking for this thread with Power Query. I did not use your custom code tho. Instead I built my own queries from scratch. I'm still blown away by how easy it was.

    Thank you again for the guidance. I can't wait to find another project to use this on.

  8. #8
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Copy Range from multiple Workbooks in folder, to Summary Workbook also in same folder?

    That's a great response - I'm delighted you took the time to introduce yourself to Power Query. It really is one of the best things to happen with Excel in many years!

    Once you are comfortable with shaping your data using Power Query, then spend some time learning about building a data model using Power Pivot...

+ 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. Copy a Range from each workbook in a folder to another folder
    By Romina in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-10-2015, 05:53 AM
  2. Replies: 1
    Last Post: 01-06-2015, 10:13 AM
  3. Copy a Range from each workbook in a folder to another folder
    By Romina in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-06-2015, 05:44 AM
  4. Moving data from monthly workbooks into summary workbook in same folder
    By hyneso in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-05-2013, 07:15 PM
  5. Replies: 3
    Last Post: 10-24-2012, 06:41 AM
  6. copy & paste data from multiple workbooks to new workbook in a folder
    By Ignesh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-01-2012, 03:11 AM
  7. Make a summary workbook from a folder of workbooks
    By MSRemmert in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 07-08-2010, 10:16 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