Sunday, April 4, 2010

Subtract the given no.of days from today

Enter the no.of days to be subtracted from today

for eg:- if Now returns 3rd April 2010
and you enter 3 ... then it would return 31st March 2010

Sub Sub_dates()

x = InputBox("Enter the no.of days to be subtracted frm today")
y = DateAdd("d", -x, Now)
z = Mid(y, 1, InStr(1, y, " ") - 1)

MsgBox z
End Sub

No comments:

Post a Comment