用VBA怎样能取最近4周(包括本周)的周一的日期?
用VBA怎样能取最近4周(包括本周)的周一的日期?
[解决办法]
用 Weekday、dateadd两个函数
[解决办法]
楼主还搞不懂?
dim a
dim b
a = date
msgbox a
while weekday(a,vbmonday) <> 1
a = dateadd("d", -1, a)
wend
msgbox a
for b = 1 to 3
a = dateadd("ww",-1, a)
msgbox a
next
[解决办法]
这个太容易了:
Dim datMonday As Date, datToday As Date
datToday = Date
datMonday = datToday - Weekday(datToday, vbMonday) - 20
Debug.Print datMonday
datMonday = datMonday + 7
Debug.Print datMonday
datMonday = datMonday + 7
Debug.Print datMonday
datMonday = datMonday + 7
Debug.Print datMonday