+ Reply to Thread
Results 1 to 8 of 8

Macro that displays all the weeks between Start Week and End Week (ends in next year)

  1. #1
    Forum Contributor
    Join Date
    10-17-2014
    Location
    EU
    MS-Off Ver
    2013
    Posts
    114

    Macro that displays all the weeks between Start Week and End Week (ends in next year)

    I have production planning Sheet (Week.xlsx)

    In column A I have starting week of the production, in column B I have end week of production.

    What I would like is to get is macro, that will display all the weeks between "start week" and "end week".

    I have macro that displays all the numbers between stated figures (eg. 32-36, it inputs 32, 33, 34, 35, 36), but if my start week is 52 which is the last week in the year I would like macro to display eg. 52-3, 52, 1, 2, 3.

    Please see attached file.
    Many thanks.
    Attached Files Attached Files
    Last edited by Tona; 10-30-2014 at 08:58 AM.

  2. #2
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,647

    Re: Macro that displays all the weeks between Start Week and End Week (ends in next year)

    Please find the attached sheet and click on the Green Button on Test Sheet to see if you get the desired output.
    Attached Files Attached Files
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  3. #3
    Forum Contributor
    Join Date
    10-17-2014
    Location
    EU
    MS-Off Ver
    2013
    Posts
    114

    Re: Macro that displays all the weeks between Start Week and End Week (ends in next year)

    Thank you sktneer.

    It works if cell is exact 52.
    But it won't work if start week is eg. 48 or 50 or 51 and end week 3?
    So every time it exceeds 52 or if it includes 52 should go from 1.

  4. #4
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,647

    Re: Macro that displays all the weeks between Start Week and End Week (ends in next year)

    Please find the attached sheet to see if this works as per your requirement now.
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    10-17-2014
    Location
    EU
    MS-Off Ver
    2013
    Posts
    114

    Re: Macro that displays all the weeks between Start Week and End Week (ends in next year)

    Perfect! Thank you.

    Will try to understand it now.

  6. #6
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,647

    Re: Macro that displays all the weeks between Start Week and End Week (ends in next year)

    You're welcome.
    You may also click on * (star) to Add Reputation if the solution provided helped you. This is another way to say thanks.

  7. #7
    Forum Contributor
    Join Date
    10-17-2014
    Location
    EU
    MS-Off Ver
    2013
    Posts
    114

    Re: Macro that displays all the weeks between Start Week and End Week (ends in next year)

    When I modify macro for my needs, I get "debug":

    Please Login or Register  to view this content.
    Any ideas why?

  8. #8
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,647

    Re: Macro that displays all the weeks between Start Week and End Week (ends in next year)

    Not sure unless I see your sheet.

    BTW change this line of code
    Please Login or Register  to view this content.
    To
    Please Login or Register  to view this content.

+ 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. week number based on year start 01/10
    By tony0710 in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 07-02-2014, 12:21 PM
  2. [SOLVED] Determine Week Start Date From Year And Number
    By SalientAnimal in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 12-23-2013, 07:51 AM
  3. Replies: 1
    Last Post: 10-04-2013, 10:04 AM
  4. [SOLVED] IF statment to bring back RAG status on week end between multiple week-ends
    By jonathan.haynes in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-04-2013, 12:45 PM
  5. Insert a new row when week ends / week starts?
    By dvent in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-09-2008, 01:13 PM

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