Dr. Demento
Well-known Member
- Joined
- Nov 2, 2010
- Messages
- 618
- Office Version
- 2019
- 2016
- Platform
- Windows
I am having issues getting keyboard shortcuts with ALT to work and I'm wondering if I'm doing something wrong. The CTRL+SHIFT shortcuts work fine; however, in order to minimize re-assigning native CTRL shortcuts that I normally use, I've moved on to using ALT. However, they don't function at all - no error message, nothing.
The code below is in a normal module and is called from the ThisWorkbook on opening. All the CTRL+SHIFT shortcuts work fine but ALT+SHIFT and ALT+CTRL do not. For the ALT+SHIFT, Excel attempts to use it's native ALT shortcut; I get no response of any kind for ALT+CTRL.
Thanks y'all.
The code below is in a normal module and is called from the ThisWorkbook on opening. All the CTRL+SHIFT shortcuts work fine but ALT+SHIFT and ALT+CTRL do not. For the ALT+SHIFT, Excel attempts to use it's native ALT shortcut; I get no response of any kind for ALT+CTRL.
Thanks y'all.
Code:
Sub assign_ShortcutKeys()
' ~~ Assign shortcut keys programmatically
' http://vbadud.blogspot.com/2007/06/assigning-shortcut-keys-excel-macros.html
' http://www.contextures.com/excelvbasendkeys.html#keycombo
' ~~ Two alternatives to assign shortcuts
' http://codevba.com/excel/Application.htm#OnKey vs http://codevba.com/excel/Application.htm#MacroOptions
' ~~ Alt key = Percentage (%) symbol _
Ctrl key = Caret (^) symbol _
Shift key = Plus (+) symbol
' ~~ Disable Save (Ctrl str): Application.OnKey "^s", ""
' application.OnKey "^{F12}", "show_ShortCuts" ' ~~ Show Msgbox with all assigned shortcuts
Application.OnKey "%^D", "styles_delete" ' ~~ Delete all custom styles in WorkBook
Application.OnKey "^+D", "del_blankCells" ' ~~ Delete blank cells within user selected range
Application.OnKey "^+F", "run_format_byHeader_arr" ' ~~ Format data
Application.OnKey "^+H", "Format_HeaderFooter_ACTIVE" ' ~~ Header/Footer update
Application.OnKey "%+L", "rng_toList" ' ~~ Transform a range with blanks and/or multiple columns into a single column list
End Sub