+ Reply to Thread
Results 1 to 5 of 5

Generating week commencing date for 52weeks.

  1. #1
    Registered User
    Join Date
    06-02-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    5

    Question Generating week commencing date for 52weeks.

    Hey guys I'm new to Macros and VB programming. I just wanted to Know if there can be a code written for generating week commencing dates for next 52 weeks if a random date is given as Start date.

    For example 15 June 2012 is the Start date, +6 days would be end of first week, the macro should generate the 22 June 2012 -28 June 2012 as week 2, 29 June 2012 - 5 July 2012 and so on for next 52 weeks as the output.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Generating week commencing date for 52weeks.

    Hello sritantry,

    Welcome to the Forum!

    Let's say row 1 is used for column headers. The user inputs the random date in cell "A2". You would add the following formulas to cells B2, A3, and B3.

    B2 =A2+6
    A3 =A2+7
    B3 =A3+6

    Select cells A3:B3 and drag the formula down A52:B52 (50 more cells).
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    06-02-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Generating week commencing date for 52weeks.

    Thank you Leith, but I was looking for a VB script code, as i need to make further more additional enhancements to the above mentioned. Its like i need to calculate Pay which has quite some conditions.

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Generating week commencing date for 52weeks.

    Hello sritantry,

    This can be converted in VBA code. Can you tell me more about how the date will be input - worksheet cell, UserForm, InputBox? Where will the output be displayed?

  5. #5
    Registered User
    Join Date
    06-02-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Generating week commencing date for 52weeks.

    Hi Leith,

    The input will be in the Worksheet cell and the out put should also be in worksheet cell. All data should be on the worksheet however the background would on the VB code.

    For your quick reference I have attached the drat for which the code needs to be written.

    Regards
    Srikanth
    Attached Files Attached Files

+ 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