Consulting

Results 1 to 3 of 3

Thread: Solved: Last weeks date

  1. #1
    VBAX Regular
    Joined
    Aug 2011
    Posts
    10
    Location

    Exclamation Solved: Last weeks date

    Hi,
    I am very new to VBA - i need a messagebox that will will display last mondays date regardles of todays date i,e today is 17/8/2011 or 19/08/2011 but i need it to display 08/08/2011 this will also need to change for the following week i,e display 15/08/2011 if the date 23/08/11, this will then need to be confirmed and then put into cell B3.
    Any help wil be grately appricated

    Thanks
    Keith

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Try

    [vba]

    Range("B3").Value = Date - Weekday(Date, 2) + 1 - 7
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Regular
    Joined
    Aug 2011
    Posts
    10
    Location
    Works perfect, thank you very much

    Keith

Posting Permissions

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