View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_5_] Dave Peterson[_5_] is offline
external usenet poster
 
Posts: 1,758
Default Macro keyboard shortcuts

If you export the module to a .bas file, then look at that file using notepad,
you can see the shortcut.

You can assign the shortcut after the fact using:
tools|macro|macros|options button

You can assign a shortcut in code, too. Take a look at
application.macrooptions:

Option Explicit
Sub testme()
MsgBox "hi"
End Sub
Sub createshortcut()
Application.MacroOptions macro:=ThisWorkbook.Name & "!testme", _
hasshortcutkey:=True, ShortcutKey:="C"
End Sub

This assigns ctrl-Shift-C to that TestMe msgbox routine

Roger PB wrote:

When using Excel's macro recorder to define a macro, one has the option of
giving it
a keyboard shortcut.
This appears in the finished macro as a comment.
But comments are not executed, I thought.

So what and where is the code giving the subroutine a shortcut, and how
would one enter it on the code page directly rather than by using the
macro recorder?

Roger PB


--

Dave Peterson