+ Reply to Thread
Results 1 to 6 of 6

Want to merge specific cells from 1000+ files into one master file

  1. #1
    Registered User
    Join Date
    02-14-2013
    Location
    San Antonio, USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Want to merge specific cells from 1000+ files into one master file

    Hello, thank you in advance for any help you can provide. I have 1063 files with the same format, all are titled [somethinghere]_Expression_Report.txt and they are all in the same folder. The contents of the files have four columns and I want to copy specific contents into a master file (ExpressionCounts19.xlsx).

    From each file I need to retrieve the following cells and paste them into a single new column in the master file:

    B2
    B4
    B5
    C10:C2334

    Here is an example file 801120_Expression_Report.txt

    Then I need to open the next file and do the same thing for the next column of the master file and so forth. The text in the cells I need to paste is all numbers. Is this possible with a macro or formula?

    Thank you!

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Want to merge specific cells from 1000+ files into one master file

    this should do it.... install in your master workbook, name the main sheet Master and edit the fPath to where your text files are stored.
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Want to merge specific cells from 1000+ files into one master file

    Ah, the joys of next generation sequencing

    Try the following changing the path as appropriate.



    Please Login or Register  to view this content.
    Open up the VBA editor by hitting ALT F11

    Insert a new module by hitting Insert - Module

    Paste the macro into the empty sheet

    Hit ALT F11 to get back to the worksheet.

    Run the macro by going to tools-macro in Excel 2003 or the view ribbon in Excel 2007/2010.
    Last edited by JBeaucaire; 02-15-2013 at 02:51 AM. Reason: Corrected code tags
    Martin

  4. #4
    Registered User
    Join Date
    02-14-2013
    Location
    San Antonio, USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Want to merge specific cells from 1000+ files into one master file

    Yes yes, NGS :-)

    I appreciate both replies but something is hanging up when I try either script, so I assume I am setting up the macro wrong. When I run either of them absolutely nothing happens, but when I run other macros I've written or obtained from nice people like you they work fine. I'm trying to solve the issue and thank you for a place to start.

  5. #5
    Registered User
    Join Date
    02-14-2013
    Location
    San Antonio, USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Want to merge specific cells from 1000+ files into one master file

    I got it! Thanks again!

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Want to merge specific cells from 1000+ files into one master file

    I have marked this thread solved for you.
    In the future please select Thread Tools from the menu above and mark the thread as solved. Thanks.

+ 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