View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Milliseconds in Excel

I don't think it will work the way you are doing it, but this worked:

Sub BB()
Dim dt As Double
hr = 10
Min = 10
sec = 10
ml = 0.001
dt = hr / 24 + Min / (24 * 60) _
+ (sec + ml) / (24# * 60# * 60#)
ActiveCell.Value = dt
ActiveCell.NumberFormat = "hh:mm:ss.000"
Debug.Print ActiveCell.Text
End Sub

--
Regards,
Tom Ogilvy

"dhg4" wrote in message
ups.com...
Can Excel handle milliseconds? Or is the only way to do it as a string?
The code below chokes on cDate(full_time)

full_time = Format(hr, "00") & ":" & Format(mn, "00") & ":" &
Format(sc, "00")
full_time = full_time & "." & Format(ml, "000")
Worksheets(2).Cells(ind, 1) = cDate(full_time)