+ Reply to Thread
Results 1 to 4 of 4

Open an xlsx with most recent date in filename, run my data pulling macro, then move file

  1. #1
    Registered User
    Join Date
    01-30-2013
    Location
    Hong Kong
    MS-Off Ver
    Excel 2007
    Posts
    5

    Open an xlsx with most recent date in filename, run my data pulling macro, then move file

    Hi,

    I'm currently trying to create a master list of prices of a product that changes from day to day. In order to do this more efficiently, I want to write a macro that will pull data from the daily workbook (always formatted in the same way eg: 31 Jan 2013.xlsx) that I download to a specific path every morning. Once the data has been pulled, I want the workbook to close and be moved to an archive folder. I have tried various codes that I've found on here for the file opening. I understand that I have to write something that will take Date and search for it in DD MMM YYYY format and loop it while subtracting 1 day from it each time. Here is the code I am using so far for the file opening:

    Please Login or Register  to view this content.
    The code above seems to get stuck in the loop and can not open the file. I typically only have one file in the folder (the current day) so I can adjust it to work exclusively for the current day, but I get these prices sometimes on a Sunday and I'll have to do Date - 1 on Monday. Can someone help me fix this one?

    Also will need help with how to refer to the opened file once it's been opened as my data pulling macro pulls from over 10 different groups of cells so the code switches the Active workbook back and forth between the master and the daily. Finally the file moving as well to path: C:\Daily Prices\Archived.

    Sorry for the long post, I want to make sure I cover all the bases in one post.
    Last edited by alanwu07; 01-31-2013 at 05:25 AM.

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Open an xlsx with most recent date in filename, run my data pulling macro, then move f

    Please Login or Register  to view this content.
    If solved remember to mark Thread as solved

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,042

    Re: Open an xlsx with most recent date in filename, run my data pulling macro, then move f

    If there is only the one .xlsx file in "C:\Daily Prices\" , this will open it regardless of its name.

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    01-30-2013
    Location
    Hong Kong
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Open an xlsx with most recent date in filename, run my data pulling macro, then move f

    Thank you! I included my data collection code into this and modified the names slightly and everything works like a charm. 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