Microsoft Excel Hints and Tips

I use F2 (edit) all the time, but often press F1 by mistake. How do I disable F1 so that nothings happens if I press it ?

Press Alt + F11 to display the Visual Basic Editor and then double click on ThisWorkbook - Now enter the following code:

Private Sub Workbook_Open()
Application.OnKey "{F1}", ""
End Sub

If you would like this to apply to all your workbooks then save a workbook containing this piece of code into your XLSTART folder. The location of this folder can be found by running the following macro code:

Public Sub ShowPaths()
MsgBox Application.StartupPath
End Sub

Note - To navigate to this folder you will need to configure My Computer to Show hidden files and folders. In My Computer select Tools > Folder Options > View and then select Show hidden files and folders.

Back to Questions Index

Return to Excel Exchange homepage.