Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Time with decimal places?
Hi everyone, I've written a little macro which is a countdown timer. I'm trying to get it to countdown on screen showing decimal places in the seconds, to do this I've set the format as "hh:mm:ss.00". I know this works for general times as I've tried putting "=now()" and holding down F9. However, when I run my macro it only counts down in whole seconds and the decimal places just stay as "00". This is my code: Sub Countdown() Dim StartTime As Double, CDL As Double, EndTime As Double, NowTime As Double Dim YesNo As Integer CDL = Range("Timer") StartTime = Now EndTime = StartTime + CDL Do NowTime = EndTime - Now If NowTime < 0 Then NowTime = 0 Range("Timer") = NowTime Loop Until NowTime = 0 YesNo = MsgBox("Reset timer?", vbYesNo) If YesNo = 6 Then Range("Timer") = CDL End Sub (apart from the fact that it has the proper indenting which this forum seems to remove ;) ) I've tried dim-ing them as dates but that doesn't make any difference. Any suggestions anyone? Many thanks, Rob -- Rob_T ------------------------------------------------------------------------ Rob_T's Profile: http://www.excelforum.com/member.php...fo&userid=4952 View this thread: http://www.excelforum.com/showthread...hreadid=556388 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Converting decimal time to standard time? | Excel Discussion (Misc queries) | |||
Can you set to default the # of decimal places in Format Cells? | Setting up and Configuration of Excel | |||
Highest & lowest place value / decimal places of cell value | Excel Worksheet Functions | |||
Max decimal places | Excel Discussion (Misc queries) | |||
DECIMAL PLACES IN FORMULAS | Excel Worksheet Functions |