
Trapping Onkey or Keypress in UserForm : please help
I have set up a UserForm for data entry/modification that fires up
when I click any row on a sheet. The UserForm displays all the fields
on that particular row in the form of comboboxes and textboxes.
I would like to be able to change rows just by pressing Alt-Up or
Alt-Down. The pseudo code for this would be something like :
Detect Alt-Up/Alt-Down anywhere in Userform
Hide ? or Unload ? Userform
Move Up/Down one row in worksheet
Load ? Show ? Repaint ? Userform with new row's fields
(If possible, position cursor in same control as it was on previous
row/form).
Onkey appears not to work when focus is on any Userform control.
Reading Usenet archives, I seem to remember someone recommending the
use of Keypress, with a caveat for Textboxes (easier for buttons than
for textboxes?), but I can't relocate that particular post. I think it
had something to do with creating a class module.
What is the coding logic for this problem (where do I put the code,
what is the code, is there any danger of recursive behaviour, i.e.
when the form on the "new" row unloads as a result say of clicking OK
or Cancel, will control pass back to the "initially selected
row/form"... etc) ?
Any help would be much appreciated. TIA.
Richard