'Gets the last friday's date
strCurrentSysDate = Date
strModDate = dateadd("ww",-1,strCurrentSysDate)
numWeekDay = 6- weekday(strModDate)
strModifiedDate = dateadd("d",numWeekDay,strModDate)
strmonth =left(monthname(month(strModifiedDate)),3)
If len(cstr(day(strModifiedDate))) < 2 Then
strDate = "0"&day(strModifiedDate)
else
strDate = day(strModifiedDate)
End If
strYear = year(strModifiedDate)
strPrevDate = strmonth& "/" & strDate & "/" & strYear
Msgbox strPrevDate
strCurrentSysDate = Date
strModDate = dateadd("ww",-1,strCurrentSysDate)
numWeekDay = 6- weekday(strModDate)
strModifiedDate = dateadd("d",numWeekDay,strModDate)
strmonth =left(monthname(month(strModifiedDate)),3)
If len(cstr(day(strModifiedDate))) < 2 Then
strDate = "0"&day(strModifiedDate)
else
strDate = day(strModifiedDate)
End If
strYear = year(strModifiedDate)
strPrevDate = strmonth& "/" & strDate & "/" & strYear
Msgbox strPrevDate
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.