Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Show Milliseconds
This should write to cells in intervals of 0.125 seconds, and display units
of seconds to 3dp Public Declare Function GetTickCount _ Lib "kernel32.dll" () As Long Sub test() Dim tNow As Long, tNext As Long Dim tStart As Long Dim nInterval As Long Const C As Long = 86400000 With Range("A1:A100") .Clear .NumberFormat = "mm:ss.000" End With nInterval = 125 tStart = GetTickCount tNext = tStart For n = 1 To 17 Cells(n, 1) = (tNext - tStart) / 86400000 tNext = tNext + nInterval Do While GetTickCount <= tNext Loop Next End Sub Regards, Peter T "Ndel40" wrote in message ... I am trying to build a program to show elapsed time and I want to display the time in "hh:mm:ss.000" format (the worksheet cell is formated as indicated). However, I can't get milliseconds to change... always stays at 000. Here is a test module I am using to try and get the right format... any help would be appreciated. Sub test() Dim ntime As Date Dim counter As Integer counter = 0 Do While counter < 5 ntime = Time Range("e7").Value = Format(ntime, "hh:mm:ss.000") counter = counter + 1 MsgBox Format(ntime, "hh:mm:ss.000") Loop End Sub Thanks! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
hh:mm:ss AND Milliseconds? | Excel Discussion (Misc queries) | |||
Show Milliseconds | Excel Programming | |||
Working With Times / Milliseconds | Excel Worksheet Functions | |||
Milliseconds in Excel | Excel Programming | |||
Milliseconds In VB | Excel Programming |