PC Review


Reply
Thread Tools Rate Thread

100ths of a second

 
 
TADropik
Guest
Posts: n/a
 
      28th Feb 2008
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 With Quote
 
 
 
 
RB Smissaert
Guest
Posts: n/a
 
      28th Feb 2008
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" <(E-Mail Removed)> wrote in message
news:A7CAFFC1-BD30-4CC9-8EAF-(E-Mail Removed)...
> 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 With Quote
 
TADropik
Guest
Posts: n/a
 
      28th Feb 2008
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" <(E-Mail Removed)> wrote in message
> news:A7CAFFC1-BD30-4CC9-8EAF-(E-Mail Removed)...
> > 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I count min bt 100ths =?Utf-8?B?RXhjZWxsIG5vdmljZQ==?= Microsoft Excel Misc 1 13th Jul 2006 03:19 PM
In Excel how do I format swimming times - mm.ss.100ths Microsoft Excel Programming 0 13th Sep 2004 02:12 PM
Re: In Excel how do I format swimming times - mm.ss.100ths Tom Ogilvy Microsoft Excel Programming 0 13th Sep 2004 02:03 PM
Re: In Excel how do I format swimming times - mm.ss.100ths JE McGimpsey Microsoft Excel Programming 0 13th Sep 2004 01:58 PM
Use mm.sec.100ths format with formula RichM Microsoft Excel Misc 2 7th Oct 2003 05:09 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:14 PM.