Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

Excel.KeyboardDirection enum

Package:
excel

Remarks

API set: ExcelApi 1.13

Used by

Examples

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/42-range/range-get-range-edge.yaml

await Excel.run(async (context) => {
 // Get the selected range.
 const range = context.workbook.getSelectedRange();

 // Specify the direction with the `KeyboardDirection` enum.
 const direction = Excel.KeyboardDirection.up;

 // Get the active cell in the workbook.
 const activeCell = context.workbook.getActiveCell();

 // Get the top-most cell of the current used range.
 // This method acts like the Ctrl+Arrow key keyboard shortcut while a range is selected.
 const rangeEdge = range.getRangeEdge(
 direction,
 activeCell // If the selected range contains more than one cell, the active cell must be defined.
 );
 rangeEdge.select();

 await context.sync();
});

Fields

down = "Down"
left = "Left"
right = "Right"
up = "Up"

Feedback

Was this page helpful?