#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 29
Default date function

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 ??
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 219
Default date function

'/==========================================/
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,
--
Gary Brown

If this post was helpful, please click the ''Yes'' button next to ''Was this
Post Helpfull to you?''.


"Stan Halls" wrote:

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 ??

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 29
Default date function

Thank you for that i worked a treat,,,,,,

"Gary L Brown" wrote:

'/==========================================/
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,
--
Gary Brown

If this post was helpful, please click the ''Yes'' button next to ''Was this
Post Helpfull to you?''.


"Stan Halls" wrote:

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 ??

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
"year" date function scott Excel Discussion (Misc queries) 3 September 11th 06 01:54 PM
Date formulas DRondeau Excel Discussion (Misc queries) 7 September 6th 06 09:53 PM
Mileage Claim Formula johndavies New Users to Excel 4 August 14th 06 09:24 AM
NETWORKDAYS - Multiple Date Selection Annabelle Excel Discussion (Misc queries) 3 October 4th 05 07:04 PM
Date function Dee Excel Worksheet Functions 2 July 13th 05 03:32 PM


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

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

About Us

"It's about Microsoft Excel"