Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Excel - As an accurate timing device?

Status
Not open for further replies.

danharman

Technical User
Apr 24, 2001
22
AU
Is it possible to use MS Excel as a timing and recording device (by way of some VBA procedure)? If so, does anyone know the accuracy of the times that could be recorded (i.e. to 1000ths of a second?).

Any help would be appreciated.

Cheers,

Dan.
 
So, here's my response from just this afternoon to someone's question (looking to time a macro)...

"And if you want a greater level of granularity, you can do miliseconds like this:


Code:
Private Declare Function adh_apiGetTime Lib "winmm.dll" _
    Alias "timeGetTime" () As Long

Sub real_fast()

  Dim dblTime As Double
  Dim dblEndTime As Double

  dblTime = adh_apiGetTime

  For i = 1 To 1000000
      j = i
  Next i

  dblEndTime = adh_apiGetTime

  MsgBox "That took " & (dblEndTime - dblTime) & " miliseconds."

End Sub"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top