Calc - Deleting multiple rows - Selection windows goes back to single

Hello Everyone,

In Calc if you window select say 5 rows and then you use the “Insert Rows Above” tool it will add another 5 rows, keeping the selection window at 5 rows so you can repeat this function if desired.

If you try the same thing with the “Delete Rows” tool it will delete 5 rows but then the selected window of 5 rows gets delete leaving behind just one cell selected, preventing you from repeating this process again.

Probably not really a bug, I would imagine this is programmed to function this way on purpose, which does make sense, but is there any way of making this react the way I describe above?

Thank You

You could write a macro and assign to a hotkey to perform this function.

OpenOffice Macros Explained

Edit to add example macro.

Note. original range is selected, as seen by the colour of the column and row titles, but the selected range is no longer shaded. Maybe I’m missing something here.

REM  *****  BASIC  *****

Option Explicit

Sub DeleteRange
'	Delete Range and keep the current selection range

	Dim oCurSelection As Object
	Dim oController As Object
	Dim sAbsoluteName As String
	
	oCurSelection = thisComponent.CurrentSelection
	sAbsoluteName = oCurSelection.AbsoluteName

	oCurSelection.Spreadsheet.removeRange(oCurSelection.RangeAddress, com.sun.star.sheet.CellDeleteMode.UP)
	
	oController = ThisComponent.getCurrentController()
	
	oController.select(oCurSelection.Spreadsheet.getCellRangeByName(sAbsoluteName))
End Sub