+ Reply to Thread
Results 1 to 2 of 2

Exporting Data from Multiple Workbooks to a Master List

Hybrid View

  1. #1
    Registered User
    Join Date
    09-24-2009
    Location
    New York, USA
    MS-Off Ver
    Excel 2003
    Posts
    1

    Exporting Data from Multiple Workbooks to a Master List

    Hi there,

    I'm looking for help coding a specific macro multiple workbook task. Here's what I'm trying to do:

    I have a folder, titled "Analysis". Inside it there is a "MasterList.xls" workbook and a "Data" folder.
    Inside the "Data" folder are all my source workbooks.
    The source workbooks are for two variables ('Word' or 'Image'), two conditions each ('6'--which is 'bigger', and '7'--which is 'smaller'), so there are 4 types of workbooks:
    "6word_XXXX.xls"
    "7word_XXXX.xls"
    "6image_XXXX.xls"
    "7image_XXXX.xls"
    where XXXX is the subject number; there are about 150 subjects, so its 600 files, give or take.
    In the each workbook, there is only ONE worksheet per workbook.
    In the 'word' workbooks, I need to 'grab' 24 specific data points to export to the MasterList.xls
    In the 'image' workbooks, I need to 'grab' 48 specific data points to export to the MasterList.xls
    The MasterList.xls workbook has 5 worksheet tabs, only two of which are relevant: "Words" and "Images".

    I want the Macro to:

    Open MasterList.xls
    Make some sort of list of the Data directory
    Make a loop using the list of the Data directory
    In that loop,
        For each '6word_*.xls" file:
            Open each file
            Grab the subject number (it's always in "A1")
            Grab the 24 specific values
            Export them to the MasterList, "Words" worksheet, on the next empty row in order (so on one row: SubjNum, Value1, Value2, etc.)
        End
        For each '7word_*.xls" file:
            Open each file
            Find that subject's previous line from the other condition (so if the current file is "7word_LZ154", it can take its own subject number from the current file (always "A1") and match it up with the LZ154 line from "6word_LZ154")
            Then, enter the grabbed 24 values from the 7word_*.xls file, starting with column "AA", as thats where all the 7word values start
        End
        For each '6image_*.xls" file:
            Open each file
            Grab the subject number (it's always in "A1")
            Grab the 48 specific values
            Export them to the MasterList, "Images" worksheet, on the next empty row in order (so on one row: SubjNum, Value1, Value2, etc.)
        End
        For each '7image_*.xls" file:
            Open each file
            Find that subject's previous line from the other condition (so if the current file is "7image_LZ154", it can take its own subject number from the current file (always "A1") and match it up with the LZ154 line from "6image_LZ154")
            Then, enter the grabbed 48 values from the 7word_*.xls file, starting with column "AY", as thats where all the 7image values start
        End
    End loop
    Hope this is clear. Thanks in advance for all the help!

    -bck

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Exporting Data from Multiple Workbooks to a Master List

    Here's an example that I posted for someone else recently. It combines data from several workbooks
    Attached Files Attached Files
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ 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