+ Reply to Thread
Results 1 to 8 of 8

Get the YEAR of past weeknum with DateSerial in Excel VBA

  1. #1
    Forum Contributor
    Join Date
    04-02-2012
    Location
    Brazil
    MS-Off Ver
    Excel 2007 & 2013
    Posts
    268

    Get the YEAR of past weeknum with DateSerial in Excel VBA

    Hello Guys,

    How can I get the YEAR of past weeknum using the below example:

    Please Login or Register  to view this content.
    With the above example, I am getting the weeknum 13(which is the past week, which is fine), but how can I get its YEAR which is 2015?


    Thanks!

  2. #2
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Get the YEAR of past weeknum with DateSerial in Excel VBA

    Try....
    Please Login or Register  to view this content.
    after , "ww"
    Not sure if it will work, but, wont hurt to try. At least I hope it wont.
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  3. #3
    Forum Contributor
    Join Date
    04-02-2012
    Location
    Brazil
    MS-Off Ver
    Excel 2007 & 2013
    Posts
    268

    Re: Get the YEAR of past weeknum with DateSerial in Excel VBA

    No, it is not working, it is giving me 2014 as the year which is wrong, I should get 2015

  4. #4
    Forum Expert
    Join Date
    02-22-2013
    Location
    London, UK
    MS-Off Ver
    Office 365
    Posts
    1,218

    Re: Get the YEAR of past weeknum with DateSerial in Excel VBA

    Try:
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    04-02-2012
    Location
    Brazil
    MS-Off Ver
    Excel 2007 & 2013
    Posts
    268

    Re: Get the YEAR of past weeknum with DateSerial in Excel VBA

    Thanks everyone!! Special thanks to berlan!

  6. #6
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Get the YEAR of past weeknum with DateSerial in Excel VBA

    Welcome. Glad the code I provided didn't hurt anything.

  7. #7
    Forum Contributor
    Join Date
    04-02-2012
    Location
    Brazil
    MS-Off Ver
    Excel 2007 & 2013
    Posts
    268

    Re: Get the YEAR of past weeknum with DateSerial in Excel VBA

    Thanks gmr4evr1. Have a great day everyone!!

  8. #8
    Forum Expert
    Join Date
    02-22-2013
    Location
    London, UK
    MS-Off Ver
    Office 365
    Posts
    1,218

    Re: Get the YEAR of past weeknum with DateSerial in Excel VBA

    You're welcome trizzo, happy to help! Feel free to let me know if you need my assistance / have any threads unsolved.

    Kind regards,
    berlan

+ 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. [SOLVED] Get the last weeknum with DateSerial in Excel VBA
    By trizzo in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-03-2015, 10:00 AM
  2. [SOLVED] DateSerial - macro for desired year
    By Lukael in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-27-2014, 01:40 AM
  3. [SOLVED] WEEKNUM year-end bug
    By jkray622 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-25-2013, 04:43 PM
  4. Weeknum including year
    By craigc in forum Excel General
    Replies: 2
    Last Post: 01-07-2011, 12:25 PM
  5. [SOLVED] Weeknum & Year
    By AnitaML in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-08-2005, 11:05 AM

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