enabling F2 only

LFKim2018

Active Member
Joined
Mar 24, 2018
Messages
267
I want to use function key F2 only - disabling all other function keys
what is the vba for enabling function key F2 only and return to default when exiting workbook
should the code be written in thisworkbook or in modules?
Thank you very much
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
I would like to share the solution for this query:

Private Sub Workbook_Open()
Application.OnKey "{F1}", ""
Application.OnKey "{F3}", ""
Application.OnKey "{F4}", ""
Application.OnKey "{F5}", ""
Application.OnKey "{F6}", ""
Application.OnKey "{F7}", ""
Application.OnKey "{F8}", ""
Application.OnKey "{F9}", ""
Application.OnKey "{F10}", ""
Application.OnKey "{F11}", ""
Application.OnKey "{F12}", ""
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,455
Messages
6,178,768
Members
452,875
Latest member
Disastrouscoder

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top