Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Worksheet Functions / October 2006

Tip: Looking for answers? Try searching our database.

date function

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Stan Halls - 19 Oct 2006 17:44 GMT
i am trying to creat a script than i can assign to a button, so when i click
on it a dialog box appears with which will show tha days,hours,min and
secounds left till a given date that i can adjust in the script ,,,,
I have mannaged to get one to work in lotus 123 but not sure how to do it in
excel, any ideas ??
Gary L Brown - 19 Oct 2006 22:06 GMT
'/==========================================/
Sub TimeLeft()
 'days,hours,min and secounds left till a given date
 Dim dblTimeLeft As Double
 Dim dblDays As Double
 Dim dblHours As Double
 Dim dblMinutes As Double
 Dim dblSeconds As Double
 Dim strDate As String
 
 strDate = "10/31/2006 08:00 AM"
 
 dblTimeLeft = DateValue(strDate) + TimeValue(strDate) - Now()
 dblDays = Int(dblTimeLeft)
 dblHours = Int((dblTimeLeft - dblDays) * 24)
 dblMinutes = _
   Int((dblTimeLeft - dblDays - (dblHours / 24)) * 24 * 60)
 dblSeconds = _
   Int((dblTimeLeft - dblDays - (dblHours / 24) - _
   (dblMinutes / 24 / 60)) * 24 * 60 * 60)
 
 MsgBox _
   "Days: " & dblDays & vbCr & _
   "Hours: " & dblHours & vbCr & _
   "Minutes: " & dblMinutes & vbCr & _
   "Seconds: " & dblSeconds & vbCr, vbInformation, _
   "Time Left until " & strDate & "..."

End Sub
'/==========================================/
HTH,
Signature

Gary Brown
gary_brown@ge_NOSPAM.com
If this post was helpful, please click the ''Yes'' button next to ''Was this
Post Helpfull to you?''.

> i am trying to creat a script than i can assign to a button, so when i click
> on it a dialog box appears with which will show tha days,hours,min and
> secounds left till a given date that i can adjust in the script ,,,,
> I have mannaged to get one to work in lotus 123 but not sure how to do it in
> excel, any ideas ??
Stan Halls - 20 Oct 2006 14:00 GMT
Thank you for that i worked a treat,,,,,,

> '/==========================================/
> Sub TimeLeft()
[quoted text clipped - 33 lines]
> > I have mannaged to get one to work in lotus 123 but not sure how to do it in
> > excel, any ideas ??
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.