Time with decimal places?

R

Rob_T

Hi everyone,

I've written a little macro which is a countdown timer. I'm trying t
get it to countdown on screen showing decimal places in the seconds, t
do this I've set the format as "hh:mm:ss.00". I know this works fo
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 an
the decimal places just stay as "00".

This is my code:

Sub Countdown()

Dim StartTime As Double, CDL As Double, EndTime As Double, NowTim
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 foru
seems to remove ;) )

I've tried dim-ing them as dates but that doesn't make any difference
Any suggestions anyone?

Many thanks,

Ro
 
T

Toppers

Rob,
Misread your post but I don't believe you can get milliseconds
without some VBA programming. I believe I MIGHT be able to dig something out
 
R

Rob_T

Well, it seems to work just on the spreadsheet. As a test, on the same
spreadsheet I put another cell below the "Timer" range with exactly the
same format. In there I've put "=now()" and that counts in milliseconds
while the cell above (the countdown) counts only in seconds :confused:


It's not vital really, I just think it looks a bit cooler if you can
see the milliseconds rattling off :rolleyes:

Cheers,

Rob
 
R

Rob_T

Well, it seems to work just on the spreadsheet. As a test, on the same
spreadsheet I put another cell below the "Timer" range with exactly the
same format. In there I've put "=now()" and that counts in milliseconds
while the cell above (the countdown) counts only in seconds :confused:


It's not vital really, I just think it looks a bit cooler if you can
see the milliseconds rattling off :rolleyes:

Cheers,

Rob
 
R

Rob_T

I'll see if I can give that a try. I'm not sure the IT people here will
like me installing unofficial stuff on my PC though. I'll see if I can
sweet-talk them ;)

Cheers,

Rob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top