((HSSFSheetImpl)sheet).shiftBothRange(tRow, bRow, nRow, lCol, rCol, nCol, true); //nCol != 0 && nRow != 0
final List<MergeChange> changeMerges = prepareChangeMerges(refSheet, shiftedRanges);
final Set<Ref> last = refs[0];
final Set<Ref> all = refs[1];
shiftFormulas(all, sheet, tRow, bRow, nRow, lCol, rCol, nCol);
all.add(new AreaRefImpl(tRow, lCol, bRow, rCol, refSheet)); //original selection
final int maxrow = book.getSpreadsheetVersion().getLastRowIndex();
final int maxcol = book.getSpreadsheetVersion().getLastColumnIndex();
int ntRow = Math.max(0, tRow + nRow);
int nlCol = Math.max(0, lCol + nCol);
int nbRow = Math.min(maxrow, bRow + nRow);
int nrCol = Math.min(maxcol, rCol + nCol);
if (ntRow <= nbRow && nlCol <= nrCol)
all.add(new AreaRefImpl(ntRow, nlCol, nbRow, nrCol, refSheet));
return new ChangeInfo(last, all, changeMerges);
}