View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default How do I write a macro for keeping time?

Private nTime As Double

Public Sub SetKeys()
Application.OnKey "{F5}", "StartTimer"
Application.OnKey "{F6}", "StopTimer"
End Sub

Public Sub StartTimer()
nTime = Timer
End Sub

Public Sub StopTimer()
MsgBox Timer - nTime & "secs"
End Sub

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"TomK76" wrote in message
...
I would like to write a macro that will work in Excel 2003 that would
enable
a user to use keys on the keyboard (F5 and F6 for example) to start and
stop
a timer function and return the amout of time elapsed between
keystrokes...like a stop watch. I would like to use this to track machine
downtime.