Freeze Option

Discuss the spreadsheet application
Post Reply
dannydont
Posts: 10
Joined: Tue Apr 08, 2008 9:18 pm

Freeze Option

Post by dannydont »

In comparing the Freeze Option in Excel to that In Calc, Ctrl+Home takes you to the first "unfrozen" cell in Excel, while Ctrl+Home takes you to the very first cell (A1) in Calc. Is there any key stroke combination that allows you to have Calc act as Excel in this situation to take you to the first "unfrozen" cell?
Thanks - Dan
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Freeze Option

Post by Villeroy »

Yes, it's a useful feature. The following macro does the job. If the window is split rather than frozen, it jumps to the first cell of the currently last pane. If the window is neither split nor frozen it jumps to A1, just like Ctrl+Home. You may try to replace the built-in Ctrl+Home with this macro.
Tools>Macros>Organize...Basic, [Organizer...]
Tab "Libraries": Pick your preferred library or add a some library, let's say "Calc"
Tab "Modules": Paste the below routine into any module.
Save the library (Ctrl+S)

Code: Select all

Sub gotoFirstCellOfLastPane()
	oEmpty = ThisComponent.CreateInstance("com.sun.star.sheet.SheetCellRanges")
	oView = ThisComponent.getCurrentController()
	oSh = oView.getActiveSheet()
	nCount = oView.getCount()
	oPane = oView.getByIndex(nCount -1)
	nCol = oView.getSplitColumn()
	nRow = oView.getSplitRow()
	oPane.setFirstVisibleColumn(nCol)
	oPane.setFirstVisibleRow(nRow)
	oView.select(oSh.getCellByPosition(nCol, nRow))
	oView.select(oEmpty)
End Sub
Tools>Customize... tab:"Keyboard"
Save in: "OOo Calc"
Pick a shortcut from the big box
Category: "OOo Macros">"user">"Calc">"Module1"
Function: "gotoFirstCellOfLastPane"
[Modify]
Notice the option to backup and reload your customized shortcuts in/from file (buttons "Save...", "Load...")
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply