Ask Your Question
0

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

asked 2016-08-27 18:07:07 +0200

miketurn gravatar image

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

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2016-08-27 18:30:53 +0200

mark_t gravatar image

updated 2016-08-27 21:02:59 +0200

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
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-08-27 18:07:07 +0200

Seen: 418 times

Last updated: Aug 27 '16