+ Reply to Thread
Results 1 to 8 of 8

VBA to extract data from multiple workbooks into one consolidated document

  1. #1
    Valued Forum Contributor
    Join Date
    09-09-2009
    Location
    Liverpool, England
    MS-Off Ver
    W: 2021 H: 365
    Posts
    940

    VBA to extract data from multiple workbooks into one consolidated document

    Morning all,

    I’m due to receive a number of supplier bids shortly and I’d like a macro that will do all the heavy ‘lifting and shifting’ to create a consolidated price summary. All the bids received will be placed into a single folder and so I’d like the macro to loop through the open, extraction and closure process for each workbook.

    Attached is an example of the bid template and consolidated summary. The consolidated summary workbook also contains the data mapping that is required. It lists the tab and relevant range from which the data is to be extracted from the bid workbooks. Directly to the right of that is the destination mapping for where the data needs to go in the consolidated workbook.

    I hope this makes sense? If you have any queries or require any further information just give me a shout.

    Thanks in advance,

    Snook

  2. #2
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: VBA to extract data from multiple workbooks into one consolidated document

    This should get you started.
    Just change SourceFolderName to correct folder with all submissions.
    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

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

    Re: VBA to extract data from multiple workbooks into one consolidated document

    An alternative approach, using Power Query to combine the data, then output into a pivot table, formatted to suit:

    Query: Combine Data In Folder (change folder path)
    Please Login or Register  to view this content.
    Query: fnEachWorkbook
    Please Login or Register  to view this content.

    Query: fnService
    Please Login or Register  to view this content.

    Query: fnProduct
    Please Login or Register  to view this content.

    Query: fnProject
    Please Login or Register  to view this content.

    See attached file for worked example.
    Attached Files Attached Files
    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...

  4. #4
    Valued Forum Contributor
    Join Date
    09-09-2009
    Location
    Liverpool, England
    MS-Off Ver
    W: 2021 H: 365
    Posts
    940

    Re: VBA to extract data from multiple workbooks into one consolidated document

    Thanks both, much appreciated.

    Given the time constraint for this task I'll give Bakerman2's solution a whirl and will let you know how I get on.....

    Thanks for your alternative solution though Olly, Power Query is something I keep meaning to take the time to understand but never get around to. This solution gives me a reason to set the ball rolling on it.

    Regards,

    Snook

  5. #5
    Valued Forum Contributor
    Join Date
    09-09-2009
    Location
    Liverpool, England
    MS-Off Ver
    W: 2021 H: 365
    Posts
    940

    Re: VBA to extract data from multiple workbooks into one consolidated document

    Is it possible to tweak the code so that it identifies which supplier cells have been populated (across the 'service', 'product' and 'project' tabs) and return one of those names? At the moment it is picking it up from cell C2 on the 'Service' tab but if a supplier isn't bidding on that work then the cell will be blank.

    Cheers,

    Snook

  6. #6
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: VBA to extract data from multiple workbooks into one consolidated document

    Try this one.
    Please Login or Register  to view this content.
    Last edited by bakerman2; 03-17-2018 at 07:05 PM. Reason: Minor tweak.

  7. #7
    Valued Forum Contributor
    Join Date
    09-09-2009
    Location
    Liverpool, England
    MS-Off Ver
    W: 2021 H: 365
    Posts
    940

    Re: VBA to extract data from multiple workbooks into one consolidated document

    Cheers bakerman2, it works a treat!

    Snook

  8. #8
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: VBA to extract data from multiple workbooks into one consolidated document

    Glad to help and thanks for rep+.

+ 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. Code to Extract data from multiple workbooks and Multiple sheet
    By Masa1989 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-04-2015, 07:05 AM
  2. need to extract data from several worksheets to a consolidated worksheet.
    By keyboardwarrior in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-14-2014, 02:03 AM
  3. Replies: 3
    Last Post: 01-05-2013, 02:20 AM
  4. Copy data from multiple workbooks into consolidated/master workbook
    By mobro1234 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-02-2012, 02:42 PM
  5. Extract data from multiple workbooks
    By mclav in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-06-2011, 04:46 PM
  6. Data Extract from Multiple Workbooks.
    By realdealsxbl in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-04-2008, 11:13 PM
  7. Replies: 7
    Last Post: 05-10-2008, 05:24 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