Results 1 to 2 of 2

Thread: Time Sheet

  1. #1
    Join Date
    Aug 2006
    Posts
    27

    Unanswered: Time Sheet

    I need to do a timesheet where a Supervisor will enter employees hours worked. What's the easiest way to get the date for the beginning of the week. Ex. if the beginning of the week is Sunday and the supervisor logs in on Tuesday, I would like to get the date for the beginning of that week so I can date the days.

    S M T W Th
    9/12 9/13 9/14 9/15 9/16 etc.......................


    Thanks.

  2. #2
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Hi markvan

    I am not sure how/where you are displaying the dates but this should give you a start !

    Code:
    Sub test()
        MsgBox "Sunday = " & Format(DateAdd("d", -Weekday(Date, vbSunday) + 1, Date), "mm/dd")
        MsgBox "Monday = " & Format(DateAdd("d", -Weekday(Date, vbSunday) + 2, Date), "mm/dd")
        MsgBox "Tuesday = " & Format(DateAdd("d", -Weekday(Date, vbSunday) + 3, Date), "mm/dd")
        MsgBox "Wednesday = " & Format(DateAdd("d", -Weekday(Date, vbSunday) + 4, Date), "mm/dd")
        MsgBox "Thursday = " & Format(DateAdd("d", -Weekday(Date, vbSunday) + 5, Date), "mm/dd")
        MsgBox "Friday = " & Format(DateAdd("d", -Weekday(Date, vbSunday) + 6, Date), "mm/dd")
        MsgBox "Saturday = " & Format(DateAdd("d", -Weekday(Date, vbSunday) + 7, Date), "mm/dd")
    End Sub
    There could, of course, be a simpler solution(s).

    MTB

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •