+ Reply to Thread
Results 1 to 6 of 6

Grab data from all files with certain name in a folder

  1. #1
    Forum Contributor
    Join Date
    10-24-2008
    Location
    England
    Posts
    146

    Grab data from all files with certain name in a folder

    I have a folder called 2009
    Is it possible to have a spreadsheet that when opened grabs data from every file with "*invoice" in the title in folder 2009 and all its sub directories and puts them into a list in the opened file?

    The data needed is to be from sheet1, cells B16, C18, G18 from all the files
    and i would like B16 put into A2, C18 into B2 and G18 into C2
    Then the next sheets data B16 to A3, C18 B3 and G18 to C3 etc etc until all files with invoice in the title have been added.

    B16 is a name
    C18 is an address and
    G18 is a postcode

    This means there can be no duplicates so if opened twice there will only ever be 1 of the same address and postcode.

    Many Thanks
    if anyone can help it would be much appreciated
    Last edited by Directlinq; 06-29-2009 at 05:12 PM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Grab data from all files with certain name in a folder

    Put this n a code module. Note that it requires a reference to Microsoft Scripting Runtime.
    Please Login or Register  to view this content.
    Then in another module, try this (untested):
    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Contributor
    Join Date
    10-24-2008
    Location
    England
    Posts
    146

    Re: Grab data from all files with certain name in a folder

    I am getting a type mismatch error 13 at line

    Please Login or Register  to view this content.
    any ideas

    Many Thanks

  4. #4
    Forum Contributor
    Join Date
    10-24-2008
    Location
    England
    Posts
    146

    Re: Grab data from all files with certain name in a folder

    Ok sorted my mismatch error and now the macro runs but for some reason.

    The cells that are being copied from the invoice sheet to the new sheet are working but when the macro reads the next invoice sheet it overwrites the prevous cells

    Also is there a way i can stop duplicates appearing in the list??

    Many Thanks

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

    Re: Grab data from all files with certain name in a folder

    Try changing this line:
    Please Login or Register  to view this content.
    As for duplicates, even a SINGLE character difference would make an evaluation extremely difficult for Excel to do on its own.

    Perhaps a separate macro you can use to sort the data by the address columns will make it simple for you to scan them?
    _________________
    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!)

  6. #6
    Forum Contributor
    Join Date
    10-24-2008
    Location
    England
    Posts
    146

    Re: Grab data from all files with certain name in a folder

    Thank You Perfect

+ 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