+ Reply to Thread
Results 1 to 6 of 6

Pulling data from files by part of file name

  1. #1
    Registered User
    Join Date
    09-02-2008
    Location
    Richmond
    Posts
    71

    Pulling data from files by part of file name

    I have forms by differnet departments each day.

    The files are saved as the department's name then date

    Byrd 82708.xsl

    I need a command button that will pull data from three cells in each of these forms.

    The master list will not be in the same folder as the deparment forms, the cells are E20, f20, f25

    I have a text box were the user will input the date, by this date I would like all forms with this date in that folder to have their data pulled from those three cells and returned in master list.
    Last edited by VBA Noob; 10-06-2008 at 04:37 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    09-19-2008
    Location
    It varies ...
    MS-Off Ver
    Office365 - 64bit
    Posts
    862
    Let me see if I understand what you're saying ...

    - You have a master list in directory "A".
    - There are depatment forms - separate ones for each dept and day - where the file names are appended with the date. These are in directory "B".
    - In the master list, being an excel file, you pop up an input box, the user enters a date, and you want to find all the department files for that date and extract from each one the data in cells E20, F20 & F25.
    - This data is appended (?) to the master list in 3 columns.
    - Presumably, you would have at least 5 columns in the master list ... one each for: department, date, and the 3 extracted bits of data?

    If this is right ... what happens if data for the date the user inputs is already in the master sheet? Delete & replace? Add duplicate? Ignore & advise the data is already there?
    MatrixMan.
    --------------------------------------
    If this - or any - reply helps you, remember to say thanks by clicking on *Add Reputation.
    If your issue is now resolved, remember to mark as solved - click Thread Tools at top right of thread.

  3. #3
    Registered User
    Join Date
    09-02-2008
    Location
    Richmond
    Posts
    71

    update

    Yes to call your questions and the last one would be replace, but their shouldn't be since the master file will be empty each time. The master file will be saved by date also for another program.

  4. #4
    Valued Forum Contributor
    Join Date
    09-19-2008
    Location
    It varies ...
    MS-Off Ver
    Office365 - 64bit
    Posts
    862
    Hi james580 ... here are two sub routines; paste them into the workbook that contains your master sheet. You may need to move it into whichever file is calling this and create a master sheet for each date, but i'll leave that to you. Also attached are the test files I created ..
    Please Login or Register  to view this content.
    Hope that helps. MM.
    Attached Files Attached Files
    Last edited by MatrixMan; 10-06-2008 at 07:24 AM. Reason: reloaded file

  5. #5
    Valued Forum Contributor
    Join Date
    09-19-2008
    Location
    It varies ...
    MS-Off Ver
    Office365 - 64bit
    Posts
    862
    Hi james580 - if you've seen the post below, you might be trying to modify it to cater for how I think you've got it structured, which is that you have a "control" book which invokes the process, then separate master books in their own directory (i've assumed they're labelled "Master - 05 Oct 08" and "Master - 06 Oct 08" and so on) and the department files in their own directory (i've assumed they're labelled "dept A - 05 Oct 08" and "dept B - 05 Oct 08" and so on).

    SO - i've reworked the code below so it now runs in this structure; it's a little rushed i'm afraid (end of day!), but it does run and i've trapped most of the common errors you might come across.

    Anway - this may be useful if you're looking to extend the code as i've assumed - new "control" and test files are attached as well.

    Put these in your workbook object:
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    And then something to call it (from an input box in your case - the button on w/sheet 1 in my example) - so for me this is in w/sheet 1:
    Please Login or Register  to view this content.
    Please read the notes / comments carefully .. and if you step through the code, I'm sure you'll see what's happening

  6. #6
    Registered User
    Join Date
    09-02-2008
    Location
    Richmond
    Posts
    71

    Smile Worked Great

    Worked Great thanks

+ 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. create a list in file 1 with data from file 2,3,4...n
    By lanes in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-27-2008, 08:41 AM
  2. Search for a file and bring back data to a master workbook – PART 2
    By ndrichie in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-06-2008, 10:47 AM
  3. [SOLVED] Working with data from different xl files
    By dziw in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 10-23-2007, 09:46 PM
  4. Macro pulling data from separate file help
    By shmeh in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-05-2007, 01:01 PM
  5. Copy Data from File A to File B
    By Wizz in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-10-2007, 05:10 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