+ Reply to Thread
Results 1 to 4 of 4

Search files until date is found

  1. #1
    Forum Contributor
    Join Date
    11-06-2012
    Location
    New Jersey, US
    MS-Off Ver
    Excel 2007
    Posts
    174

    Search files until date is found

    Hello,

    I need to search through a directory for the correct file according to the date in the cell.

    Looping through column A, if a string = "GB", then string A is the (0, 1) offset which is the date.
    The "sched_Jan_May.xls" opens in the H: directory and finds the correct date etc.

    I have all of that working correctly. The dilemna is when there are 2 files in the same directory,
    e.g. sched_Jan_May.xls and sched_June_September.xls.....
    If the string A, which is the date is not found in the first file, how can I open the second file?
    Also - I need to exit if found in the first file
    I can't depend on which was modified last b/c they both are being constantly updated.



    Here is a sample of the code I have so far:

    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    09-05-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Search files until date is found

    Not sure exactly if this is what you're asking but you can use an If... then... else if... statement:
    Please Login or Register  to view this content.
    Or a Select Case statement:
    Please Login or Register  to view this content.
    Last edited by AKarel; 04-09-2013 at 01:22 PM.

  3. #3
    Forum Contributor
    Join Date
    11-06-2012
    Location
    New Jersey, US
    MS-Off Ver
    Excel 2007
    Posts
    174

    Re: Search files until date is found

    Hello - thank you for replying.

    I need to search a file in column A for "GB"...if there is one loop through row one in H:\sched_*.xlsm,
    and search for the date. if none is to be found, open the second H:\sched_*.xlsm and search until date is found

  4. #4
    Forum Contributor
    Join Date
    11-06-2012
    Location
    New Jersey, US
    MS-Off Ver
    Excel 2007
    Posts
    174

    Re: Search files until date is found

    I think the main issue and what I'm looking for is how to loop the 1st row of file...if date isnt found...open up another file
    in the same directory and search the first row in that one....both are named similar(sched_April_July.xls and sched_Aug_Oct.xls)
    for 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