ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Detecting key presses (https://www.excelbanter.com/excel-programming/363711-detecting-key-presses.html)

Jonathan Smith

Detecting key presses
 
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

Jim Thomlinson

Detecting key presses
 
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...
--
HTH...

Jim Thomlinson


"Jonathan Smith" wrote:

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


Mat P:son[_2_]

Detecting key presses
 
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...

"Jim Thomlinson" wrote:

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...
--
HTH...

Jim Thomlinson


"Jonathan Smith" wrote:

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



All times are GMT +1. The time now is 01:05 AM.

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