Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
100ths of a second
is it possible to calculate 100ths or even 1000ths of a second in Excel.
I can calculate the time difference between 2 cells down to the second, but is it possible to calculate down to the 100th of a second? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
100ths of a second
Use the TimeGetTime API.
Option Explicit Private lStartTime As Long Private Declare Function timeGetTime Lib "winmm.dll" () As Long Sub StartSW() lStartTime = timeGetTime() End Sub Function StopSW(Optional bMsgBox As Boolean = True, _ Optional vMessage As Variant, _ Optional lMinimumTimeToShow As Long = -1) As Variant Dim lTime As Long lTime = timeGetTime() - lStartTime If lTime lMinimumTimeToShow Then If IsMissing(vMessage) Then StopSW = lTime Else StopSW = lTime & " - " & vMessage End If End If If bMsgBox Then If lTime lMinimumTimeToShow Then MsgBox "Done in " & lTime & " msecs", , vMessage End If End If End Function Sub test() Dim i As Long StartSW For i = 1 To 10000000 Next i StopSW End Sub RBS "TADropik" wrote in message ... is it possible to calculate 100ths or even 1000ths of a second in Excel. I can calculate the time difference between 2 cells down to the second, but is it possible to calculate down to the 100th of a second? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
100ths of a second
That worked perfect.
Thank you for that. Now if I can just get macros to run on my Cell Phone I have a nice little stop watch to carry with me. ;-) "RB Smissaert" wrote: Use the TimeGetTime API. Option Explicit Private lStartTime As Long Private Declare Function timeGetTime Lib "winmm.dll" () As Long Sub StartSW() lStartTime = timeGetTime() End Sub Function StopSW(Optional bMsgBox As Boolean = True, _ Optional vMessage As Variant, _ Optional lMinimumTimeToShow As Long = -1) As Variant Dim lTime As Long lTime = timeGetTime() - lStartTime If lTime lMinimumTimeToShow Then If IsMissing(vMessage) Then StopSW = lTime Else StopSW = lTime & " - " & vMessage End If End If If bMsgBox Then If lTime lMinimumTimeToShow Then MsgBox "Done in " & lTime & " msecs", , vMessage End If End If End Function Sub test() Dim i As Long StartSW For i = 1 To 10000000 Next i StopSW End Sub RBS "TADropik" wrote in message ... is it possible to calculate 100ths or even 1000ths of a second in Excel. I can calculate the time difference between 2 cells down to the second, but is it possible to calculate down to the 100th of a second? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How can I count min bt 100ths | Excel Discussion (Misc queries) | |||
Calculating time worked using 100ths of an hour, from 1 day into n | New Users to Excel | |||
In Excel how do I format swimming times - mm.ss.100ths | Excel Programming | |||
In Excel how do I format swimming times - mm.ss.100ths | Excel Programming | |||
In Excel how do I format swimming times - mm.ss.100ths | Excel Programming |