ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Subtracting Dates VBA (https://www.excelbanter.com/excel-programming/332320-subtracting-dates-vba.html)

Werner[_9_]

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 :


Sub datescalcul()
Dim Baux As Double
Baux = Application.DATEDIF(Worksheets("Formulaire").Range ("I16").Value,
Worksheets("Formulaire").Range("J16").Value, "m") / 12
sheets("Formulaire").Range("K16").Value = Baux
End Sub


But it does not work. Maye it is that dateDif Excel function cannot be
converted in VBA function?
Thx!

Werner


--
Werner
------------------------------------------------------------------------
Werner's Profile: http://www.excelforum.com/member.php...o&userid=24304
View this thread: http://www.excelforum.com/showthread...hreadid=380612


Werner[_10_]

Subtracting Dates VBA
 

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).

Werner


--
Werner
------------------------------------------------------------------------
Werner's Profile: http://www.excelforum.com/member.php...o&userid=24304
View this thread: http://www.excelforum.com/showthread...hreadid=380612



All times are GMT +1. The time now is 02:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com