+ Reply to Thread
Results 1 to 10 of 10

vba macro to consolidate selected data from multiple workbooks

  1. #1
    Registered User
    Join Date
    12-19-2010
    Location
    mumbai, India
    MS-Off Ver
    Excel 2003
    Posts
    71

    vba macro to consolidate selected data from multiple workbooks

    Hello All,

    I work on multiple excel workbooks. I have 50 workbooks. each consists of around 35 columns. On daily basis I have to filter out data from few columns of each workbook and paste the data one below the other and make one final file. thts everydays tasks.

    I want a macro wherein I can give the list of filters that I want apply on select columns. The macro will go to each workbook and apply given filter on given column and copy the data to a fresh workbook one below the other.

    If anyone can help me with this,

    Thanks.

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,056

    Re: vba macro to consolidate selected data from multiple workbooks

    It would be easier to help if we could see how your data is organized. Perhaps you could attach 2 or 3 source files. De-sensitize them if necessary. Explain in detail what you want to do using a few examples and referring to specific cells rows and columns.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Registered User
    Join Date
    12-19-2010
    Location
    mumbai, India
    MS-Off Ver
    Excel 2003
    Posts
    71

    Re: vba macro to consolidate selected data from multiple workbooks

    I have attached 3 source files and one final file for reference.

    procedure is as follows. I open source_1 file and apply below given filters on that file.

    select below given values on the columns with header given below:
    Header H = "S2389"
    Header I = greater than 1000 (i.e. ">1000")

    copy the data and paste in a new excel workbook.

    then I repeat the same steps on source_2 file and paste the data in newly open excel workbook in above step.

    and same steps for source_3 file.

    in the end I get one final file which consists of filtered data from 3 source files.

    I hope I am pretty clear this time. But still let me know in case of any confusion.

    Thanks.
    Attached Files Attached Files

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,388

    Re: vba macro to consolidate selected data from multiple workbooks

    Hi,

    This feature is built into Power Query, which is available in newer versions of Excel.

    https://www.youtube.com/watch?v=wFMiW8nL9ow
    or
    http://excelunplugged.com/2015/02/10...n-power-query/

    Have you considered upgrading your version?
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  5. #5
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,056

    Re: vba macro to consolidate selected data from multiple workbooks

    The macro can be designed to open the files for you as long as the folder containing all your source files contains only those files and no others. If this is the case, what is the full path to the folder containing the source files?
    Last edited by Mumps1; 11-25-2017 at 03:06 PM.

  6. #6
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,056

    Re: vba macro to consolidate selected data from multiple workbooks

    Assuming that all your source files are in the same folder and they are they only files in that folder, try the following macro by placing it in a regular module in a new blank workbook and run it from there. Change the folder path in the macro where indicated to suit your needs.
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    12-19-2010
    Location
    mumbai, India
    MS-Off Ver
    Excel 2003
    Posts
    71

    Re: vba macro to consolidate selected data from multiple workbooks

    Mumps1,

    Great. The code works perfectly well, just one catch here.

    Its not mandatory that filter will be on 6th or 12th column necessarily. That is why I mentioned header "H" and header "I". Filter will be based on header. So code should give us the freedom to enter header name for putting filter.

    Rest code is very smooth and give exact result.

    Thanks a ton once again for the help.

  8. #8
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,056

    Re: vba macro to consolidate selected data from multiple workbooks

    Try:
    Please Login or Register  to view this content.
    This macro will prompt you to enter the column number (not the header name) of the two columns you want to use to filter the data. I could modify the macro to prompt for the column name if that is what you want. Please let me know.
    Last edited by Mumps1; 11-27-2017 at 09:50 AM.

  9. #9
    Registered User
    Join Date
    12-19-2010
    Location
    mumbai, India
    MS-Off Ver
    Excel 2003
    Posts
    71

    Re: vba macro to consolidate selected data from multiple workbooks

    Mumps1,

    very sorry for the late reply. There was some issue with my system. Hence, could not login. But I checked just now, and its working absolutely fine.

    Thanks a ton for your help. very happy.

  10. #10
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,056

    Re: vba macro to consolidate selected data from multiple workbooks

    My pleasure.

+ 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. Consolidate data from multiple workbooks
    By abdulji in forum Excel General
    Replies: 9
    Last Post: 07-29-2015, 04:08 PM
  2. [SOLVED] Consolidate all data in multiple worksheets of multiple workbooks in one Master file.
    By adil.master in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-23-2014, 09:59 PM
  3. Macro to consolidate rows of data from multiple workbooks into one worksheet
    By Sullvasio in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-08-2014, 12:18 PM
  4. Replies: 5
    Last Post: 04-12-2013, 09:16 AM
  5. Consolidate data from multiple workbooks
    By John_Day83 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-02-2013, 01:56 AM
  6. [SOLVED] Consolidate data from multiple workbooks into 1 workbook
    By VBA FTW in forum Excel Programming / VBA / Macros
    Replies: 30
    Last Post: 12-17-2012, 01:11 PM
  7. consolidate data from multiple workbooks to a single worksheet
    By vbadummy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-30-2010, 02:42 PM

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