Change the Function Keys

J

JonnieMN

I’ve been able to change the function keys in Word and assigned them
to different macros that I use often, but I haven’t been able to do
the same in Excel. For example, I want to be able to assign sorting
the entire workbook by a certain column to (Ctrl+F3) or running a
macro to (Alt+F8).
 
J

JonnieMN

Hi ,
Go to:
Tools>Macro>Macro>Options and fill in the Keys that you want.
Thanks.

Sorry, I did find the function; but the options are greyed out and I
can't change them. Is there some sharing or trusting of macros that I
need to have selected?
 
D

Dave Peterson

I don't think you can assign the ctrl-F keys using the
Tools|Macro|macros|select the macro|click options button
dialog

You could assign it another key (like ctrl-X (ctrl-shift-x))

If you want to assign the F keys, you'll need code:

Option Explicit
Sub auto_open()
'plain old F4 key
Application.OnKey "{F4}", "testme1"
'ctrl-F4
Application.OnKey "^{F4}", "testme2"
End Sub
Sub auto_Close()
Application.OnKey "{F4}"
Application.OnKey "^{F4}"
End Sub
Sub testme1()
MsgBox "hi there from F4"
End Sub
Sub testme2()
MsgBox "hi there from ctrl-F4"
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top