• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

assign keyboard shortcut key to run my macro?????

vlavan08

New Member
I have written a subroutine procedure.

would like to assign shortcut key

i used the following sentence


(Application.MacroOptions Macro:="g", HasShortcutKey:=True, ShortcutKey:="^Q")


but it is not working when i press ctrl+Q
 
Hi ,


Make the following two changes :


1. Include the sheet name in the macro name e.g. Sheet3.g


2. Remove the ^ ( caret sign ) from the Shortcut key specification , since this is automatically included by Excel ; the shortcut key must be just a letter.


Narayan
 
Still it is not working.


This is the code


Application.MacroOptions Macro:="g", HasShortcutKey:=True, ShortcutKey:="Q"


Sub g()


MsgBox "hi"


End Sub
 
Hi ,


I see that you have not incorporated my first point ; can you do that and see ?


I am sorry but I did not mention that the macro shortcut keys will be CTRL SHIFT and the letter you have used in your code ; so when invoking the macro , you will have to press CTRL SHIFT Q.


Narayan
 
Back
Top