REFERENCE
U.KEYBOARD_SHORTCUT
Summary
Registers a keyboard combination that will perform a specified action when entered
Syntax
=U.KEYBOARD_SHORTCUT(keys, target, [value], [select_target], [global], [replace_handling], [selection_scope])
Parameters
| Parameter | Required | Description |
|---|---|---|
keys |
Yes | The names of keyboard keys, separated by hyphens, that when pressed concurrently will trigger the specified action; if not set, a report of all defined shortcuts is returned. If set to "LAST" and no target set, keyboard sequences will be shown as they are entered on the keyboard |
target |
Yes | The range or ranges that, when the keyboard shortcut is entered, will be recalced or have their values updated; if a string that matches a clickval name is passed as a string, a clickval override will be applied to set that value; if hard-coded to "selection" in the equation then the target is the selected cell(s) at time the shortcut is pressed |
[value] |
No | If set, then the target will be updated with the specified value. If the target is a clickval name, that clickval will have its value set to the specified value. If hard-coded to "selection" then the value is that of the selected cell(s) when the shortcut is pressed, optionally with an offset |
[select_target] |
No | If set to TRUE then the target will be selected in addition to other actions being performed |
[global] |
No | If set to TRUE then the keyboard shortcut will be applied even if the Excel instance is not the active application in Windows. By default shortcuts are only applied if the Excel instance where it is defined is active. Provide 2 columns of values with the first TRUE and 2nd FALSE to trigger ONLY from outside the Excel instance |
[replace_handling] |
No | If set to TRUE then any standard action associated with the keyboard shortcut will be skipped; by default any standard shortcut handling is performed in addition to the custom handling |
[selection_scope] |
No | If set to one or more ranges, the keyboard shortcut will only be applied if the currently selected cell(s) is fully within one of the specified ranges |
Behavior
The documented public interface is supported by the current U Add-in source signature and the maintained Usage Examples workbook. Optional parameters are shown in square brackets in the syntax above; omit the brackets when entering a formula.
Return Value
Returns the function result or action status described by the formula and parameters above. The maintained sources do not define a narrower, stable return contract for this function.
Examples
Notes
- Formula examples are preserved from maintained workbook usage and normalized to the current
U.prefix. - Complete formulas demonstrate working patterns; they do not imply that undocumented option values are supported.
- Where maintained sources do not specify every accepted value, default, or error message, this page does not infer one.
- For functions that perform actions, use a visible trigger or supported block/throttle parameter to avoid unintended repetition during recalculation.
Related
- Concept: Workbook Automation
- How-to: Respond to Clicks and Notifications
- Example: Click-Driven Script