DateAdd returns the result of adding or subtracting a specified period of time to a date:
Sub DateAddExample()
Debug.Print DateAdd("d", 3, Now)
'Today plus 3 days
Debug.Print DateAdd("m", 3, Now)
'Today plus 3 months
Debug.Print DateAdd("yyyy", 3, Now)
'Today plus 3 years
Debug.Print DateAdd("q", 3, Now)
'Today plus 3 quarters
Debug.Print DateAdd("ww", 3, Now)
'Today plus 3 weeks
Debug.Print DateAdd("ww", -3, Now)
'Today minus 3 weeks
End Sub
Related examples in the same category