Ask Your Question

Macro to group rows

asked 2019-06-21 00:30:17 +0200

mrmfox gravatar image

Hi, I have a worksheet with a little over 20000 lines. The first column has a class which I have sorted the data by. I would like to group the rows under each class. Doing this using the Data/Group menu option works, however, trying to do this over 20000 lines will drive me insane. I am able to write a macro to identify the range of rows to be grouped. I just cannot find the macro function to invoke the group action.

Thanks in advance.

Version: Build ID: 1:5.2.7-1+deb9u7 CPU Threads: 8; OS Version: Linux 4.9; UI Render: default; VCL: gtk3; Locale: en-AU (en_AU.UTF-8); Calc: group

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2019-06-21 02:40:50 +0200

mrmfox gravatar image

updated 2019-06-21 08:09:25 +0200

Lupp gravatar image

Looks like I have found the answer. The selection of the rows needs to be done first and separately to the grouping.

oProp(0).Name = "ToPoint"
oProp(0).Value = "$2:$10"
oDispatcher.executeDispatch(oFrame, ".uno:GoToCell", "", 0, oProp())

oProp(0).Name = "RowOrCol"
oProp(0).Value = "R"
oDispatcher.executeDispatch(oFrame, ".uno:Group", "", 0, oProp())

Thanks to

edit flag offensive delete link more


Why should someone want to maintain a site with untrimmed recorded macros containing coded-in ranges?
To record a macro should be the first idea of a newcomer, anyway. Strange.

Lupp gravatar imageLupp ( 2019-06-21 08:15:42 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2019-06-21 00:30:17 +0200

Seen: 23 times

Last updated: Jun 21