+ Reply to Thread
Results 1 to 4 of 4

Excel 2007 : pull up data depending on specific date in cell

Hybrid View

  1. #1
    Registered User
    Join Date
    08-22-2011
    Location
    Laval quebec
    MS-Off Ver
    MS 365
    Posts
    99

    pull up data depending on specific date in cell

    Hi guys,

    I have a spreadsheet that needs to get data off another spreadsheet but the problem is a new report comes out daily with the same prefix filename everyday but the only thing that changed in the filename is the date in the end.

    ex: SignOn-Agents-UTOPIA - 2012-04-18 - Mercredi1.xlsx

    How can I pull up the data depending on the date i put in a specific cell?

  2. #2
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: pull up data depending on specific date in cell

    Hi
    Try this macro
    enter the file directory where it says "MyPath = "
    it assumes your default language in Excel is French - Format(Date, "dddd") comes up with "Tuesday" for me, but hopefully you'll get "Mercredi"

    Sub file_open_todays()
    Dim MyPath, MyFileName
    MyPath = "C:\Mydocuments\" 'enter file directory here, including concluding "\"
    MyFileName = "SignOn-Agents-UTOPIA - " & Format(Date, "yyyy-mm-dd") & " - " & Format(Date, "dddd") & "1.xlsx"
    Workbooks.Open Filename:=MyPath & MyFileName
    End Sub

  3. #3
    Registered User
    Join Date
    08-22-2011
    Location
    Laval quebec
    MS-Off Ver
    MS 365
    Posts
    99

    Re: pull up data depending on specific date in cell

    Hi, thank you for your reply

    Unfortunatly it did not work. As you said it is returning tuesday instead of Mardi..

    Is there a string of code I can add for it to convert it to french format?

  4. #4
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: pull up data depending on specific date in cell

    Hi
    I assume that you want a the number 1 after the french word for the day, as in your original post
    If so, try this:

    Sub file_open_todays()
    Dim MyPath, MyFileName, MyDays, MyDay As String, MyDayNum As Long
    MyDays = Array("dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi")
    MyDayNum = Application.WorksheetFunction.Weekday(Date) - 1
    MyDay = MyDays(MyDayNum)
    
    MyPath = "C:\Mydocuments\" 'enter file directory here, including concluding "\"
    MyFileName = "SignOn-Agents-UTOPIA - " & Format(Date, "yyyy-mm-dd") & " - " & MyDay & "1.xlsx"
    MsgBox MyFileName
    Workbooks.Open Filename:=MyPath & MyFileName
    End Sub

+ 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