View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Niek Otten Niek Otten is offline
external usenet poster
 
Posts: 3,440
Default 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:
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!

JJD

--
Message posted via http://www.officekb.com