Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default How do I write a macro for keeping time?

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
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.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Time Keeping Timeless Excel New Users to Excel 3 December 4th 05 01:43 AM
is it possible to execute write to the fields in another .xsl form a macro in another .xsl? e.g. some way to load another .xsl into an .xsl macro and write to its data? Daniel Excel Worksheet Functions 1 June 23rd 05 11:38 PM
How to write a macro to get the system time in excel 97 Raj Excel Discussion (Misc queries) 6 April 20th 05 07:20 PM
time keeping Jim[_22_] Excel Programming 2 February 4th 04 04:03 AM
Write a macro ro copy column at certain time of day. Daytrader Excel Programming 2 February 2nd 04 05:28 AM


All times are GMT +1. The time now is 06:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"