Ask Your Question
0

Calc: Selecting Multiple Dispersed Cells Using the Keyboard ONLY.

asked 2017-06-11 11:39:25 +0100

DenverChess gravatar image

Ok, so, maybe there isn't a way to do this but I suppose this would be the best place to check. I haven't found anything but I have a valid reason and a very practical use/need for it.

I'm trying to build a keyboard macro that formats a spreadsheet and I haven't been able to select multiple columns of cells in Calc using just the keyboard. I always have to click with the mouse if I want to be able to select another range of cells that's not adjacent to the one I selected previous I have to use the mouse to click the cell to begin the next range to be included in the selection.

For example, if I wanted to highlight cells (b6:b50) and (g6:g50) I can't seem to create this selection of cells without using the mouse to at the very minimum click on g6 to get the cursor over there. I can't seem to figure out how to do it with the keyboard alone like I have almost everything else in the application.

Is this feature not available? Am I dreaming of something that really doesn't exist? Am I asking for too much here?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2019-02-18 15:09:48 +0100

Hynerian gravatar image

A macro solution, requiring you to be in Adding mode:

sub AddActiveCellToSelection
rem ----------------------------------------------------------------------
rem define variables
dim document   as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "By"
args1(0).Value = 1

dispatcher.executeDispatch(document, ".uno:GoDownSel", "", 0, args1())

rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "By"
args2(0).Value = 1

dispatcher.executeDispatch(document, ".uno:GoUpSel", "", 0, args2())

end sub

This is just a recording of Shift-down arrow & Shift-up arrow.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-06-11 11:39:25 +0100

Seen: 84 times

Last updated: Feb 18