Thread: Changing Dates
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
IanC IanC is offline
external usenet poster
 
Posts: 49
Default Changing Dates

Spot on. Thank you very much.

"Toppers" wrote:

Ian,
Look at VBA "DateAdd" function.

Code from VBA help ...


Dim FirstDate As Date ' Declare variables.
Dim IntervalType As String
Dim Number As Integer
Dim Msg
IntervalType = "m" ' "m" specifies months as interval.
FirstDate = InputBox("Enter a date")
Number = InputBox("Enter number of months to add")
Msg = "New date: " & DateAdd(IntervalType, Number, FirstDate)
MsgBox Msg

HTH

"IanC" wrote:

I am looking to programmatically move a date forward or back by whole months
(i.e. 3, 6, or 9) - the sort of process carried out by Edate if used in a
formula. However, Edate doesn't seem to be available for use in VBA code.

Am I missing something or is there a different way around this.

Thanks in advance.