|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Is it possible to use keys like ALT for assigning shortcut key to macros in Excel?
I want to use keys like ALT and … for assigning shortcut key to macros in Excel by utilizing onkey command. (for example, I have used this line: Application.OnKey "+%{R}", "copyMRial". But it dose not work for me. (the code show no “run time” error. But when I press the shortcut to run the macro, nothing happens). |
#2
|
|||
|
|||
Here are assignments related to the ALT key :
6. ALT + Function Keys Shortcut Shortcut Key Action Alt+F1 Insert Chart (Creates a chart of the data in the current range) Alt+F2 Save As Alt+F4 Closes all workbooks & Exits Excel Alt+F8 Macro dialog box Alt+F11 Displays Visual Basic Editor 7. ALT + SHIFT + Function Keys Shortcut Shortcut Key Action alt+shft+1 Inserts a new worksheet into the active workbook Alt+Shft+F2 Displays the Save As dialog box Alt+Shft+F4 Closes all the workbooks and exits Excel Alt+Shft+F10 Displays the drop-down menu for the corresponding smart tag Alt+Shft+F11 Displays the drop-down menu for the corresponding smart tag 8. ALT + Letter Keys Shortcut Shortcut Key Action Alt + A + E Convert Text to Columns Wizard Alt + A + H Hide grouped columns or rows Alt + A + J Show grouped columns or rows Alt + A + M Displays the Remove Duplicates dialog box Alt + A + Q Advanced Filter Alt + A + SA Sort smallest to largest Alt + A + SD Sort largest to smallest Alt + A + SS Displays the Sort dialog box Alt + B Add or Remove the bottom border Alt + D Add or Remove the downward diagonal border Alt + F Go to Backstage View Alt + H Add or Remove the horizontal interior border Alt + H + AB Align text to the bottom of the cell Alt + H + AC Align text to the center of the cell Alt + H + AL Align text to the left of the cell Alt + H + AM Align text to the middle of the cell Alt + H + AN Choose accounting format Alt + H + AR Align text to the right of the cell Alt + H + AT Align text to the top of the cell Alt + H + B Expand Borders drop-down menu Alt + H + FC Choose font color Alt + H + FC Expand Font Color drop-down menu Alt + H + FF Change the font face Alt + H + FG Increase the font size by 1 point Alt + H + FK Decrease the font size by 1 point Alt + H + FM Format Cells dialog box with the Number tab selected Alt + H + FN Format Cells dialog box with the Font tab selected Alt + H + FO Clipboard task pane Alt + H + FP Activates Format Painter Alt + H + FS Change the font size Alt + H + H Expand the Fill Color drop-down menu Alt + H + J Expand the Cell Styles menu Alt + H + K Format number with a thousand’s comma (,) separator Alt + H + N Choose number format Alt + H + T Expand Format as Table drop-down menu Alt + H + T Expand the Format as Table menu Alt + H + W Wrap text Alt + JA Go to the Layout tab of the Ribbon Alt + JC Go to the Design tab of the Ribbon Alt + JC + A Expand Add Chart Element drop-down menu Alt + L Add/ Remove the left border Alt + L + I Expand the Insert Form Controls and ActiveX Controls drop-down menu Alt + M + D Trace Dependents Alt + M + P Trace Precedents Alt + N + B Insert Bar Chart Alt + N + C Insert Column Chart Alt + N + N Insert Line Chart Alt + N + Q Insert Pie or Doughnut Chart Alt + N + R Recommended Charts Alt + N + SD Insert Combo Chart Alt + N + V Pivot Table Alt + N + X Insert Text Box Alt + R Add or Remove the right border Alt + R + A Show all comments Alt + R + D Delete comment Alt + T Add or Remove the top border Alt + T + O Display Excel Options dialog box Alt + V Add or Remove the vertical interior border Alt + W + I Page Break Preview Alt + W + L Normal View Alt + W + Q Zoom dialog box Alt + W + VG View or hide gridlines |
#3
|
|||
|
|||
Thank you for your reply which I learn from it some useful shortcut keys.I think I have failed to bring up the issue in a clear manner.
Assume I have created a macro with the name "x” and I want to assign a keyboard shortcut to it (by using Onkey command or manually. see this link) . My question is: can the Alt key be used in the combination of keys which are to be assigned to” X”? Broadly speaking, I am interested about combination of keys which can be used for assigning shortcut keys to macros. |
#4
|
|||
|
|||
Further research indicates you can not use the ALT key because it is already assigned to the Menu bar at the top of the workbook. This is something that Microsoft predetermined when creating Excel.
|
#5
|
|||
|
|||
If you have the Developer tab showing on your ribbon, you should be able to look at your list of Macros with the Macro button near the far left. Under there is a button labeled 'Options...' and it allows you to add a shortcut key combination. It's not ALT but it's CONTROL + SHIFT + [letter]. For example, I use CTRL+SHIFT+A to run my address lookup. I do that for some, and for others I make custom buttons on the Quick Access Toolbar.
|
#6
|
|||
|
|||
Thank you for your guidance. I also use your methods, But the number of my macros is very much and because of this, I am considering new methods to make the process of their running more efficient.
|
#7
|
||||
|
||||
Yes it is possible but you will need to run a line of vba code to create the keyboard shortcut.
See this page and video... 2 Ways to Assign Keyboard Shortcuts to Macros - Excel Campus
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#8
|
|||
|
|||
As I told before, I have used the Onkey command mentioned in your link (for example, Application.OnKey "+%{R}", "macro name"). , but it doesn’t work although It doesn’t result in any runtime error. It seems The Alt key work for Word macro but not for Excel macro and user is left with just one option Ctr+shift+(key) which is limiting if you want to assign meaningful short cut to a large number of macro.(using Ctr +(key) has the risk of overwriting Excel own shortcut key. Even the short cut is not case-sensitive)
|
#9
|
|||
|
|||
I have found the correct answer and have changed my mind: Yes it is possible to use ALT key for assigning shortcuts to macros. The point is the line “+%{R}” must be changed to “^%R”. (see the “Table of Shortcut Key Combinations for Application.OnKey method” section of this link)
|
Tags |
onkey, shortcut |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Problem using shortcut keys | 14spar15 | Excel | 3 | 09-14-2020 11:00 PM |
Assigning shortcut keys via a macro file | alex100 | Word VBA | 6 | 06-26-2020 09:27 AM |
Shortcut keys in Find&Replace | fsdance | Word | 0 | 02-11-2011 03:27 PM |
cant use shortcut keys (ctrl+c/v/z...) | laro | Office | 0 | 10-08-2010 11:01 PM |
Can't Assign Shortcut Keys | Vicki F. | Word | 0 | 04-17-2010 03:03 PM |