Apparently, this requires copy-pasting:
- Delete the block
- Copy the data below it
- Paste it to the empty space.
(The first step can be skipped, although this may increase the risk of pasting to a wrong position.)
If you find this tedious after a while (as I did), a script can do the same. The script below adds a menu item "custom / "delete and shift up", which removes any selected range in the matter described below.
(The script is a bit longer than I expected at first, because I wanted to avoid moving long columns of empty cells, while simultaneously covering the possibility that a user may select a range than goes outside of the current DataRange.)
function onOpen() {
SpreadsheetApp.getActiveSpreadsheet().addMenu("Custom", [{name: "Delete and Shift Up", functionName: "deleteAndShiftUp"}]);
}
function deleteAndShiftUp() {
var sheet = SpreadsheetApp.getActiveSheet();
var totalHeight = sheet.getDataRange().getHeight();
var totalWidth = sheet.getDataRange().getWidth();
var toDelete = sheet.getActiveRange();
var firstRow = toDelete.getRow();
var firstColumn = toDelete.getColumn();
var lastRow = Math.min(toDelete.getLastRow(), totalHeight);
var lastColumn = Math.min(toDelete.getLastColumn(), totalWidth);
var height = lastRow-firstRow+1;
var width = lastColumn-firstColumn+1;
if (height>0 && width>0) {
if (totalHeight>lastRow) {
sheet.getRange(lastRow+1, firstColumn, totalHeight-lastRow, width)
.copyTo(sheet.getRange(firstRow, firstColumn, totalHeight-lastRow, width));
}
sheet.getRange(totalHeight-height+1, firstColumn, height, width).clear();
}
}