+ Reply to Thread
Results 1 to 5 of 5

calculates the weeks between weeks.

  1. #1
    Registered User
    Join Date
    07-31-2016
    Location
    Holland
    MS-Off Ver
    2019
    Posts
    74

    calculates the weeks between weeks.

    Hi all,


    The date is in a cell, the following code calculates the weeks between the date in the cell and the current week. The new week starts at Monday. now is the question, how can the code be made so that the new week starts at the date in the cell, and not standard at Monday

    So, if the date in the cell is on a Wednesday, that is week 1, the second week starts at Monday, but I want it to start on Wednesday.

    Please Login or Register  to view this content.
    The below code is to calculate the current week number for a date.

    Please Login or Register  to view this content.
    Looking forwards to a solution.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: calculates the weeks between weeks.

    Why do you need VBA to return what a simple Excel function will provide. Even if you want VBA then it's usually simpler just to get VBA to add the Excel function.

    But you need to give some specific examples. It's not clear what you mean by 'the date is in a cell' - what date and what cell, and 'the new week starts at 'Monday', and 'the new week starts at the date in the cell' - what cell and what's the value in the cell.

    Upload a workbook with some data and clearly identify the values and cells you start with, and manually add the results you expect clearly identofying the results.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    07-31-2016
    Location
    Holland
    MS-Off Ver
    2019
    Posts
    74

    Re: calculates the weeks between weeks.

    HI Richard, the code is part of a big code and userform, so it is not easy to upload this. Basically I want the week not to start on vbMonday, but but on the date that is in the active cell.

    Please Login or Register  to view this content.

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: calculates the weeks between weeks.

    ...sorry but you're going to have to give me some examples of what your data looks like and what resuts you expect and where you expect to see them.

    If you can't upload the actual workbook - and I'm not sure why not, then mock up a simple example. I've no idea what you're line of code is attempting to do in the absence of your workbook.

    You've not said why you need a macro when standard Excel functionality will give you what you want.

  5. #5
    Registered User
    Join Date
    07-31-2016
    Location
    Holland
    MS-Off Ver
    2019
    Posts
    74

    Re: calculates the weeks between weeks.

    Hi Richard,

    thanks for your effort. Luckily I came up with the below code, this did the job without the function WeekNum

    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. Replies: 2
    Last Post: 02-14-2017, 09:33 AM
  2. [SOLVED] Add 12 weeks to date to return week number turn over at 52 weeks
    By nigelog in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-01-2017, 05:58 AM
  3. Count the last full weeks wages for the last 12 weeks only
    By shorie7 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-25-2016, 01:59 PM
  4. Dividing monthly values into weeks automatically (some months have 5 weeks)
    By massimoo in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-07-2012, 03:20 AM
  5. difference between two dates in working weeks(5 day weeks)
    By AWilderbeast in forum Excel General
    Replies: 3
    Last Post: 08-31-2010, 09:21 AM
  6. Calculating Averages based upon weeks not include Bye Weeks
    By Kfetterman1 in forum Excel General
    Replies: 2
    Last Post: 09-27-2006, 11:18 AM
  7. Turn excel weeks into finacial weeks
    By dragonfly in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-20-2005, 10:07 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