Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Milliseconds in Excel
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) |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Milliseconds in Excel
"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) You can use the GetTickCount function from the Windows API. You have to declare it as: Option Explicit Declare Function GetTickCount Lib "kernel32" () As Long /Fredrik |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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) |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Milliseconds in Excel
Tom,
Thanks a lot. That did the trick. I really appreciate it! David |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
hh:mm:ss AND Milliseconds? | Excel Discussion (Misc queries) | |||
Working With Times / Milliseconds | Excel Worksheet Functions | |||
Excel function to find difference of timestamps in milliseconds? | Excel Discussion (Misc queries) | |||
Milliseconds in a Pivot Table | Excel Discussion (Misc queries) | |||
Milliseconds In VB | Excel Programming |