View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Show Milliseconds

not quite
?

Why can't I get millisecond results from my VB formula?


The Time function returns whole seconds since midnight

Dim td As Double
td = Time
MsgBox td & vbCr & _
td * 24 * 60 * 60 & vbCr & _
CDate(td)

Regards,
Peter T


"Ndel40" wrote in message
...
So far to the reply's... no, no and not quite, but thanks!

I can get milliseconds to show using standard excel formulas and

formatting
the cell hh:mm:ss.000

Excel Formula...
=TEXT(TIME(18,8,0)-TEXT(NOW(),"hh:mm:ss.000"),"hh:mm:ss.000")

Results in...
10:27:49.580

Why can't I get millisecond results from my VB formula?

ntime = Time
Range("e7").Value = Format(ntime, "hh:mm:ss.000")

OR

StopTime = TimeSerial(15, 15, 15)
myTime = Time
ntime = Format(myTime - StopTime, "hh:mm:ss.000")

Thanks,

Nick