![]() |
Subtracting Dates VBA
Hi,
I want to subtract two dates 'YYYYY-MM-DD' but by doing in VBA and pointing to their respective cells and dump the result in another cell. For example, I am working on this experiment : Quote:
converted in VBA function? Thx! JJD -- Message posted via http://www.officekb.com |
Subtracting Dates VBA
"does not work" does not give much information.
But in VBA, it is DATEDIFF (2 F's) Niek Otten "Jean-Jerome Doucet via OfficeKB.com" wrote in message ... Hi, I want to subtract two dates 'YYYYY-MM-DD' but by doing in VBA and pointing to their respective cells and dump the result in another cell. For example, I am working on this experiment : Quote:
But it does not work. Maye it is that dateDif Excel function cannot be converted in VBA function? Thx! JJD -- Message posted via http://www.officekb.com |
Subtracting Dates VBA
So that is without "Application."
"Niek Otten" wrote in message ... "does not work" does not give much information. But in VBA, it is DATEDIFF (2 F's) Niek Otten "Jean-Jerome Doucet via OfficeKB.com" wrote in message ... Hi, I want to subtract two dates 'YYYYY-MM-DD' but by doing in VBA and pointing to their respective cells and dump the result in another cell. For example, I am working on this experiment : Quote:
But it does not work. Maye it is that dateDif Excel function cannot be converted in VBA function? Thx! JJD -- Message posted via http://www.officekb.com |
Subtracting Dates VBA
You are right, my apologies for the lack of details.
I forgot to mention that the error is on my subtraction. It says property or method not managed by this object. And I want to return a numer of years and have decimal or where we are in the last years (e.g. 3 and a half year 3,50). Here's the way it is supposed to work : Oh and it is J16 - I16 (upper date - lower date). Werner -- Message posted via http://www.officekb.com |
Subtracting Dates VBA
Ops wrong name (I use Werner as a nickname on other forums but I use my real
name on this one.) Jean-Jérôme Doucet -- Message posted via http://www.officekb.com |
Subtracting Dates VBA
It is also a different order
With Worksheets("Formulaire") Baux = DateDiff("m", .Range("I16").Value, .Range("J16").Value) / 12 End With -- HTH RP (remove nothere from the email address if mailing direct) "Jean-Jerome Doucet via OfficeKB.com" wrote in message ... Hi, I want to subtract two dates 'YYYYY-MM-DD' but by doing in VBA and pointing to their respective cells and dump the result in another cell. For example, I am working on this experiment : Quote:
But it does not work. Maye it is that dateDif Excel function cannot be converted in VBA function? Thx! JJD -- Message posted via http://www.officekb.com |
Subtracting Dates VBA
Thank you a lot Bob!!
I adjusted a bit the code for my needs and i works perfectly! Have a good day! Werner Quote:
Message posted via http://www.officekb.com |
All times are GMT +1. The time now is 02:10 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com