+ Reply to Thread
Results 1 to 6 of 6

Filename as PRIOR month

  1. #1
    Registered User
    Join Date
    11-30-2007
    Location
    Edinburgh, UK
    MS-Off Ver
    2003
    Posts
    84

    Filename as PRIOR month

    Hi,

    I'm trying to get a bit of code to name a file as the prior month. I searching this forum and many others, as well as excel help, and even asked our traning department in work, all to no avail.

    Does anyone know how I can get this to work?

    This is what I have:

    Please Login or Register  to view this content.
    Cheers
    Last edited by VBA Noob; 05-23-2008 at 11:00 AM.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481
    Try

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    11-30-2007
    Location
    Edinburgh, UK
    MS-Off Ver
    2003
    Posts
    84
    genius!

    Thank you very much

    edit - I was probably looking in the wrong place, but couldn't find it anywhere, and no one I asked in work knew!

    That's gonna make things a lot easier - thanks!

  4. #4
    Registered User
    Join Date
    11-30-2007
    Location
    Edinburgh, UK
    MS-Off Ver
    2003
    Posts
    84
    Is there any chance you could break that down for me please?

    I'd like to know how it works if I can.

    what part of the code does what?

  5. #5
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481
    Well DateSerial returns a date based on Year, Month and Day values.

    The trick is a day of Zero will cause the function to return the day before the 1st of the month, which is the last day of the previous month.

  6. #6
    Registered User
    Join Date
    11-30-2007
    Location
    Edinburgh, UK
    MS-Off Ver
    2003
    Posts
    84
    cool, thanks very much. That's a good price of code to know

+ 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