Results 1 to 2 of 2

Thread: Last weeks Thursday date

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2000
    Posts
    98

    Last weeks Thursday date

    I would like to have last weeks Thursday date displayed in a msgbox... How can I do this?

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Last weeks Thursday date

    VB Code:
    1. Dim my_date As Date
    2. my_date = Date
    3.  
    4. 'get into the end of "last week"
    5. my_date = DateAdd("d", -Weekday(my_date), my_date)
    6.  
    7. 'count backwards to thursday
    8. Do While Weekday(my_date) <> vbThursday
    9.   my_date = DateAdd("d", -1, my_date)
    10. Loop
    11.  
    12. 'show date
    13. MsgBox Format(my_date, "ddd d m yy")

Posting Permissions

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



Click Here to Expand Forum to Full Width