Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Number of days between dates (Calendar)

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Number of Weekend Days between 2 Dates Q Seanie Excel Worksheet Functions 1 November 5th 08 04:40 PM
How to subtract 2 dates to get number of days.....please Nick Excel Worksheet Functions 3 November 10th 06 01:03 PM
Calculating number of days between two dates that fall between two other dates [email protected] Excel Discussion (Misc queries) 5 October 26th 05 06:18 PM
Find number of days between to dates Qaspec Excel Worksheet Functions 1 January 21st 05 12:14 AM
Determining number of days between dates Debbie Excel Worksheet Functions 4 January 20th 05 12:07 AM


All times are GMT +1. The time now is 06:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"