WEEK based monday

User avatar
sal21
PlatinumLounger
Posts: 4362
Joined: 26 Apr 2010, 17:36

WEEK based monday

Post by sal21 »

based this code:

Code: Select all

If Weekday(Now(), vbMonday) = 1 Then 
    MsgBox "Monday" 
Else 
    MsgBox Format$(Now, "dddd") 
End If 
if the weekday is a monday return in var INIZIO the first date of the one week back and in FINE the last date of week....how to?

for the day 13/02/2012 INIZIO=06/02/2012 FINE=12/02/2012

User avatar
HansV
Administrator
Posts: 78528
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: WEEK nased monday

Post by HansV »

Dim d As Date
d = Date
FINE = d - Weekday(d, vbSunday)
INIZIO = FINE - 6
Best wishes,
Hans