Key behaviour

  • Thread starter Thread starter Rodney
  • Start date Start date
R

Rodney

Hi there,

Is there a possibilty to capture the keycode from a
worksheet. Not from a form or checkbox or related objets.
I would like to recognize from the worksheet when a <F4>
is given to execute some code.

Many thanks in advance.
 
Hi there,

Is there a possibilty to capture the keycode from a
worksheet. Not from a form or checkbox or related objets.
I would like to recognize from the worksheet when a <F4>
is given to execute some code.

Many thanks in advance.

Just be aware that this will last for the length of your Excel
session, and will apply to ALL workbooks.

Sub GetKeyAndDoSomething()

'To make this line run automatically, put it in the
'Workbook_Open event in the Workbook's code module
'instead of a standard procedure like this one.

Application.OnKey "{F4}", "MyProcedure"

End Sub


Sub MyProcedure()

MsgBox "This is my procedure."

End Sub
 
Back
Top