ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ENTER keys to execute code to add menu (https://www.excelbanter.com/excel-programming/371455-enter-keys-execute-code-add-menu.html)

Mark Warner[_2_]

ENTER keys to execute code to add menu
 
I looked through the previous topics but didn't see what I need.

I want that when a person hits the enter key in cell C2 that it executes
code to bring up a customized menu. Also WHERE in the code does this go, a
module, or in the SHEET1 objects area?

I have tried this code:

Private_Sub SetKey()
Application.OnKey "~", "supmenu"
Application.OnKey "{ENTER}", "supmenu"
End Sub


Thanks.

stevebriz

ENTER keys to execute code to add menu
 

Mark Warner wrote:
I looked through the previous topics but didn't see what I need.

I want that when a person hits the enter key in cell C2 that it executes
code to bring up a customized menu. Also WHERE in the code does this go, a
module, or in the SHEET1 objects area?

I have tried this code:

Private_Sub SetKey()
Application.OnKey "~", "supmenu"
Application.OnKey "{ENTER}", "supmenu"
End Sub


Thanks.


Is another option to use the worksheet_change and for that cell?

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = "$C$2" Then
' do stuff here'
End If
End Sub



All times are GMT +1. The time now is 09:48 PM.

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