Say you have the line executed once somewhere:
Application.OnKey "~", "blah"
and blah is a sub such as:
Sub blah()
If ActiveCell.Column = 6 Then
MsgBox "Hi there!"
End If
End Sub
in a standard code-module.
That will almost work - the bugbear being that pressing the Enter key when not in column F doesn't quite behave normally.
If you don't want to accept that then in the code-module of the sheet that you want this to work on, put this code:
Private Sub Worksheet_Activate()
If ActiveCell.Column = 6 Then Application.OnKey "~", "blah"
End Sub
Private Sub Worksheet_Deactivate()
Application.OnKey "~"
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If ActiveCell.Column = 6 Then 'you can be more choosy here and even use Target.
Application.OnKey "~", "blah"
Else
Application.OnKey "~"
End If
End Sub
Which will disable the shortcut when you move away from the sheet and also when the activecell is not in column 6 (F).
It will also enable the shortcut when you move to that tab and the active cell happens already to be in column 6.
Also, if you use this second scenario you can probably do without the If clause in blah.