Application.DateAdd

O

Oren

Hi All,
I tried to use the Application.DateAdd function to calculate the effective date of a task which is the combination of the finish date plus the lag. When the lag >0 I get the expected result but when the lag < 0 I didn't get the expected result.
I would like to know what is the right way to do this.
Thanks in advance
Oren
 
J

JackD

It would help if you show what code you are using, what result you are
expecting and what result you are getting.
If the lag is a string value it defaults to days. If it is a non-string
value it is in minutes (typically 480 per day) so you might need to do some
division or explicit typing of the value you are using for lag. My guess is
that the - sign is turning negative lags into numbers and then the lag is
480 times what you expect.

I'd read lag into a typed variable and then use that variable in the DateAdd
function.



Oren said:
Hi All,
I tried to use the Application.DateAdd function to calculate the effective
date of a task which is the combination of the finish date plus the lag.
When the lag >0 I get the expected result but when the lag < 0 I didn't get
the expected result.
 
B

Bill Bordiuk

I think App.DateAdd doesn't like negative durations. if Lag < 0 then reverse
the sign and use Application.DateSubtract.

Bill

Oren said:
Hi All,
I tried to use the Application.DateAdd function to calculate the effective
date of a task which is the combination of the finish date plus the lag.
When the lag >0 I get the expected result but when the lag < 0 I didn't get
the expected result.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top