+ Reply to Thread
Results 1 to 11 of 11

Macro to consolidate data from many files

  1. #1
    Forum Contributor
    Join Date
    12-11-2014
    Location
    dubai
    MS-Off Ver
    2010
    Posts
    142

    Macro to consolidate data from many files

    Greetings,

    I need a macro that gathers information from 3 different workbooks and consolidates it on one master file

    Each of the three workbook has 6 different sheets, and same named and layout sheets are there in master workbook file as well

    Basically what i need is sum of the 3 files respective sheets data in to master file same named sheet in the same cells

    Eg

    Workbook 1 has sheet 1, sheet 2, sheet 3 , sheet 4, sheet 5, sheet 6
    Workbook 2 has sheet 1, sheet 2, sheet 3 , sheet 4, sheet 5, sheet 6
    Workbook 3 has sheet 1, sheet 2, sheet 3 , sheet 4, sheet 5, sheet 6

    Master has sheet 1, sheet 2, sheet 3 , sheet 4, sheet 5, sheet 6

    what i want is in master file sheet 1( sum of same cells from sheet 1 from workbook 1, sheet 1 from workbook 2 and sheet 1 from workbook 3),sheet 2( sum of same cells from sheet 2 from workbook 1, sheet 2 from workbook 2 and sheet 2 from workbook 3),sheet 3( sum of same cells from sheet 3 from workbook 1, sheet 3 from workbook 2 and sheet 3 from workbook 3),sheet 4( sum of same cells from sheet 4 from workbook 1, sheet 4 from workbook 2 and sheet 4 from workbook 3),sheet 5( sum of same cells from sheet 5 from workbook 1, sheet 5 from workbook 2 and sheet 5 from workbook 3)



    I will be eternally grateful if anyone can help me crack this!

  2. #2
    Forum Contributor
    Join Date
    12-11-2014
    Location
    dubai
    MS-Off Ver
    2010
    Posts
    142

    Re: Macro to consolidate data from many files

    Can anyone help me out please?

  3. #3
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: Macro to consolidate data from many files

    Hi
    try...
    http://chandoo.org/wp/2012/04/09/con...cel-files-vba/
    "No xadrez nem sempre a menor dist?ncia entre dois pontos ? uma linha reta" G. Kasparov.

    If your problem is solved, please say so clearly, and mark your thread as Solved: Click the Edit button on your first post in the thread, Click Go Advanced, select b from the Prefix dropdown, then click Save Changes. If more than two days have elapsed, the Edit button will not appear -- ask a moderator to mark it.

  4. #4
    Registered User
    Join Date
    02-20-2013
    Location
    bangalore
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Macro to consolidate data from many files

    You would require a nested loop of 3 loops, 1. for Master file - for each sheet run a loop 2. For all workbooks. 3. each sheet in selected workbook.

    when it is innermost loop, use the loop(sheet) value of Master making equal to sheet of other workbooks.

    Otherwise simply open all workbooks, write down formula in each sheet "=W1.sheet1!A1+W2.sheet1!A1+W2.sheet1!A1" (Something like that) and drag till your desired range. do the same for all sheets.

  5. #5
    Registered User
    Join Date
    02-20-2013
    Location
    bangalore
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Macro to consolidate data from many files

    You would require a nested loop of 3 loops, 1. for Master file - for each sheet run a loop 2. For all workbooks. 3. each sheet in selected workbook.

    when it is innermost loop, use the loop(sheet) value of Master making equal to sheet of other workbooks.

    Otherwise simply open all workbooks, write down formula in each sheet "=W1.sheet1!A1+W2.sheet1!A1+W2.sheet1!A1" (Something like that) and drag till your desired range. do the same for all sheets.

  6. #6
    Forum Contributor
    Join Date
    12-11-2014
    Location
    dubai
    MS-Off Ver
    2010
    Posts
    142

    Re: Macro to consolidate data from many files

    @ Marecco, hat doent give me desired result, it gives result from only one sheet and doesnt even add up in master file

  7. #7
    Forum Contributor
    Join Date
    12-11-2014
    Location
    dubai
    MS-Off Ver
    2010
    Posts
    142

    Re: Macro to consolidate data from many files

    @ Ayush, can u give me a sample structure of the macro,?

    when i use normal ="=W1.sheet1!A1+W2.sheet1!A1+W2.sheet1!A1" my file goes beyond 35mb, so i want to use macro to copy and later paste as values to keep file size low as possible

  8. #8
    Forum Contributor
    Join Date
    12-11-2014
    Location
    dubai
    MS-Off Ver
    2010
    Posts
    142

    Re: Macro to consolidate data from many files

    @ Ayush, can u give me a sample structure of the macro,?

    when i use normal ="=W1.sheet1!A1+W2.sheet1!A1+W2.sheet1!A1" my file goes beyond 35mb, so i want to use macro to copy and later paste as values to keep file size low as possible

  9. #9
    Forum Contributor
    Join Date
    12-11-2014
    Location
    dubai
    MS-Off Ver
    2010
    Posts
    142

    Re: Macro to consolidate data from many files

    Please Login or Register  to view this content.

    does this structure suit my requirement, it gets get run time error whenever i run it

  10. #10
    Forum Contributor
    Join Date
    12-11-2014
    Location
    dubai
    MS-Off Ver
    2010
    Posts
    142

    Re: Macro to consolidate data from many files

    range to be copied is i13:pf1162, all three files saved in one folder say D:new\segments, the master file is also present in the same folder

    Can anyone help on this please?

  11. #11
    Forum Contributor
    Join Date
    12-11-2014
    Location
    dubai
    MS-Off Ver
    2010
    Posts
    142

    Re: Macro to consolidate data from many files

    Can anyone throw some light on this please????

+ 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. [SOLVED] How to adapt the macro to allow it to consolidate files with multiple sheets?
    By billj in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-04-2013, 05:18 PM
  2. need macro to consolidate data from .xml files.
    By sekharyadav in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-27-2012, 11:03 AM
  3. Macro to consolidate the data from mutliple files using Vlookup / Match
    By pradeepkodali in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-08-2012, 01:46 PM
  4. Macro to consolidate data from many files
    By annasox in forum Excel General
    Replies: 5
    Last Post: 01-17-2011, 12:32 PM
  5. Macro to oepn multiple txt files and then consolidate
    By Nonboff in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-26-2009, 09:44 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