Perhaps something like this:
Module code:
Code:
--------------------
Option Explicit
Public Declare Function SetTimer Lib "user32" ( _
ByVal HWnd As Long, _
ByVal nIDEvent As Long, _
ByVal uElapse As Long, _
ByVal lpTimerFunc As Long) As Long
Public Declare Function KillTimer Lib "user32" ( _
ByVal HWnd As Long, _
ByVal nIDEvent As Long) As Long
Public Declare Function GetTickCount Lib "kernel32" () As Long
Public TimerID As Long
Public TimeStarted As Long
Sub StartTimer()
TimerID = SetTimer(0&, 0&, 1, AddressOf TimerProc)
End Sub
Sub EndTimer()
On Error Resume Next
KillTimer 0&, TimerID
End Sub
Sub TimerProc(ByVal HWnd As Long, ByVal uMsg As Long, ByVal nIDEvent As Long, ByVal dwTimer As Long)
Sheet1.Cells(1, 1).Value = CInt((GetTickCount - TimeStarted) / 10)
End Sub
--------------------
Worksheet code:
Code:
--------------------
Option Explicit
Private Sub CommandButton1_Click()
TimeStarted = GetTickCount
Call StartTimer
End Sub
Private Sub CommandButton2_Click()
Call EndTimer
Sheet1.Cells(1, 1).Value = ""
End Sub
--------------------
You will have to format the output to mm:ss:ds
--
mms
------------------------------------------------------------------------
mms's Profile:
http://www.excelforum.com/member.php...o&userid=16536
View this thread:
http://www.excelforum.com/showthread...hreadid=535914