VBA test - adding dates
I'm just setting up my template at the moment to handle VBA formatting - and I thought it might be a good test to use a practical example. The following code is used to add dates in VBA:
IntervalType = "m"
FirstDate = InputBox("Enter a date")
Number = InputBox("Enter number of months to add")
Msg = "New date: " & DateAdd(IntervalType, Number, FirstDate)
MsgBox Msg
The "m" used here to signify "months" could also be substituted out as one of the following:
yyyy Year
q Quarter
m Month
y Day of year
d Day
w Weekday
ww Week
h Hour
n Minute
s Second
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home