Instructions on creating a macro to move a row down by one in google sheets. Or in other words, swap the contents of the row containing the current active cell with the contents of the row below the current active cell.
This macro also supports moving multiple rows of any selected range.
There's a potential glitch if repeating the macro quickly multiple times before the previous iteration completes. It seems that google allows the next iteration to start before the first completes, which can cause an unexpected row to be shifted.
The macro takes about 1 second to execute, which is not ideal. I'm not sure if there are any ways to speed this up.
Tools > Script Editor
Should open new tab with script editor.
Replace with this text:
/** @OnlyCurrentDoc */
function shiftdown() {
var sheet = SpreadsheetApp.getActive().getActiveSheet();
var selection = sheet.getActiveRange();
sheet.moveRows(selection, selection.getLastRow() + 2);
selection.offset(1,0).activate();
};
CTRL-S
to save. Use any name, for example "macros".
Back to spreadsheet view
Tools > Macros > Import
Click on Add Function
for shiftdown
Test with:
Tools > Macros > shiftdown
You will need to authenticate to give macros permission to run.
Tools > Macros > Manage Macros
Add a number to CTRL+ALT+SHIFT+
combo