View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Number of days between dates (Calendar)

Dim cDate1 as Date, cDate2 as Date
cdate1 = Calendar1.Value
cdate2 = Calendar2.Value

Textbox1.Value = format(cdate2 - cdate1,"#0")

--
Regards,
Tom Ogilvy


"Malcolm" wrote in message
...
Hi

I have a form that has 2 calendars on it. Calendar1 is
going to be used to select a date "FROM" and Calendar2 is
going to be used to select a date "TO" with the number of
days appearing in a text box.

For instance, if Calendar1 said Sept 3 2003 and Calendar2
said Sept 4 2003, the text box would have the value 1 in
it. I can do this to a degree, but if I was to select 31
Aug 2002 in Calendar1 and 31 Aug 2003 in Calendar2, the
text box says 0 instead of 366, which would be the number
of days between the 2 dates.

Any ideas

Thanks in advance

Malcolm Davidson