Detecting key presses

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to find a way to do the following:

The user presses the "1" key in cell A1, without pressing enter, the active
cell changes to C1. Can anyone supply me with some sample code to do this.

THanks
 
You can't. keypress is not a detected event. While you are edidting the
contents of a cell no events are firing, so there is no way to do what you
want to do...
 
Well, at least theoretically speaking, there may be a way forward. If you're
a bit suicidal, you could always try snooping on the keypress messages by
using Win32 hooks. Having said that, this would require some pretty
demanding, low-level hacking and during development you'd most likely end up
watching Excel crash and burn... Often... :o)

This was probably not quite the answer you were looking for, but if you're
still interested why not browse some of the more technically oriented
programming sites, such as vbAccelerator or CodeGuru, and search for e.g.
"Hook", or look in MSDN for documentation on for example the Win32 API call
SetWindowsHook, and related.

Give me a shout if you want to know more...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top