which function?

  • Thread starter Thread starter Lauren
  • Start date Start date
L

Lauren

I want to subtract two dates from each other that will
give me a result of the number of days only. For example:
1/30/2003-1/20/2003 = 10 days
Which function should I use and how should it be written?

Thanks in advance!!
 
The DateDiff() function will do what you want. Here is an example that you
can try out as code behind a command button.

Dim x As Variant

x = DateDiff("d", #1/20/2003#, #1/30/2003#)

MsgBox x & " days"

hth,
 
Back
Top