ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problems with implementing onKey (https://www.excelbanter.com/excel-programming/337437-problems-implementing-onkey.html)

McManCSU[_26_]

Problems with implementing onKey
 

Basically I am making a stopwatch that makes a graph to track time
progress. I want to use the onKey function to act as a funciton that
will stop the timer, save the time, reset time to 0, then start it
again. I have all the methods working, but I cant seem to get the
onKey to recognize when I press the key.

I want to have the space bar as the key, but it changes the cell's
contents everytime (plus i dont know if i can use SPACE as a key). How
should I implement it first of all? It only needs to run when the
clock is actually running, so I dont think that an event on opening the
sheet is needed. Can i do something like this?

Do While Not Range("haltClock")
Range("clockArea").Value = (time() - clockStart)
If Not Range("haltTimer") Then
Range("timerArea").Value = (time() - timerStart)
End If
Application.OnKey "{ENTER}", "boardDone"
DoEvents
Loop

BTW this is what i have, but it doesnt work...


--
McManCSU
------------------------------------------------------------------------
McManCSU's Profile: http://www.excelforum.com/member.php...o&userid=24379
View this thread: http://www.excelforum.com/showthread...hreadid=396249


McManCSU[_27_]

Problems with implementing onKey
 

anyone have an idea

--
McManCS
-----------------------------------------------------------------------
McManCSU's Profile: http://www.excelforum.com/member.php...fo&userid=2437
View this thread: http://www.excelforum.com/showthread.php?threadid=39624



All times are GMT +1. The time now is 02:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com