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?
|