+ Reply to Thread
Results 1 to 9 of 9

Macro to get data from individual files and add it into one common masterfile

  1. #1
    Registered User
    Join Date
    06-14-2012
    Location
    Brussels
    MS-Off Ver
    Excel 2010
    Posts
    16

    Macro to get data from individual files and add it into one common masterfile

    Hello everyone,

    I do have multiple files in a folder, which are exactly identical but include data from different days. That means that each file has lots of lines of data, all representing one day. For example I have files:
    "Data Day 1", "Data Day 2" etc.
    What I need to do is create a masterfile, which will get the daily data from all daily files and put it in this masterfile, so that I end up having one file with all data of all days. For example I want to create a file "Masterfile Data" in which daily the new data of the new daily files is entered automatically.

    Can somebody tell me how I can create a macro, that will update the masterfile everytime a new daily file has been created and saved?

    Thank you

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro to get data from individual files and add it into one common masterfile

    So if i understand you clearly, you have multiple excel files each with 1 sheet of data and you want to consolidate these into a new workbook.

    Do you want to consolidate the sheets separately, in the sense the new file will have 1 sheet called "Data Day 1", the next sheet "Data Day 2", etc? Or do you want the data to be consolidated one below the other in one sheet of the new workbook?

    Can somebody tell me how I can create a macro, that will update the masterfile everytime a new daily file has been created and saved?
    This can be done but what about the history data? Do you want a macro that consolidates all the historical files for you till you start consolidating on a daily basis?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    10-09-2009
    Location
    Scotland
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Macro to get data from individual files and add it into one common masterfile

    Hi,

    I'm also looking for something similar where I would like the data listed in different files consolidated one below the other to form one big list with all the data. I can then sort and extract the parts I want. The only way I have to do this at the moment is copying and pasting.

    Can anybody please help with this?

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro to get data from individual files and add it into one common masterfile

    FCFalkirk,

    Unfortunately you need to post your question in a new thread, it's against the forum rules to post a question in the thread of another user. If you create your own thread, any advice will be tailored to your situation so you should include a description of what you've done and are trying to do. Also, if you feel that this thread is particularly relevant to what you are trying to do, you can surely include a link to it in your new thread.

  5. #5
    Valued Forum Contributor Naveed Raza's Avatar
    Join Date
    11-04-2012
    Location
    India, Hyderabad
    MS-Off Ver
    Excel, Access 2007/2010
    Posts
    1,338

    Re: Macro to get data from individual files and add it into one common masterfile

    Hello,
    try this code :

    for instruction plz open the attached and go through before run the macro.
    for tab selection plz make changes to this line in script window "Sheets("DPEX-REX").Select" to Sheets("key here tab name of individual sheet tab name is there").select

    from which row u want to copy adjust that also in script page (hint open script page and go step by step by presing the F8 function key)

    if u hv any queries feel free to ask.

    Thanks - Naveed.

  6. #6
    Registered User
    Join Date
    06-14-2012
    Location
    Brussels
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Macro to get data from individual files and add it into one common masterfile

    @arlu1201
    I would need to combine all the data from the individual files on one sheet in the new file (masterfile), in a table form.
    I am attaching two print screens. The one shows how the individual file looks like and the other how the masterfile (the file in which all information is compiled from the individual files) looks like.

    In blue and green you can see the cells that need to be transfered into the masterfile.
    In the individual file, in lines 18 to say 28 (10 lines total), data points will be entered. I need to transfer those points into the masterfile from column K to P and lines 2 to 12 (10 lines total). In columns A to J, the information comes from the individual file in the blue cells. This info will need to be the same for all the total 10 lines.
    Additionally, as the data in the individual files has also some formulas that calcualte different things, I want the macro to transfer in the masterfile the values only and not the formulas.
    The macro should also run once every 5 days and when it is running, it should not pull again the info from the individual files already pulled say the week before. The files always stay in the same folder.

    Thank you very much so far for the help :-)

    Individual file 1.pngMasterfile.png

  7. #7
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro to get data from individual files and add it into one common masterfile

    Did you try the file posted in post 5?

  8. #8
    Registered User
    Join Date
    06-14-2012
    Location
    Brussels
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Macro to get data from individual files and add it into one common masterfile

    I did, but for the set-up I have in my file, it is somehow not working.

    Any help please?

  9. #9
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro to get data from individual files and add it into one common masterfile

    When you say not working, do you mean you are receiving an error or its not doing anything at all?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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