Code: Select all
Sub ScrollToAvailableColumn( Optional iRowIndex )
Dim oDoc As Object : oDoc = ThisComponent
Dim sCell
Dim oController
oController = oDoc.getCurrentController()
Dim oSheet As Object : oSheet = oDoc.CurrentController.ActiveSheet
sCell = oSheet.getCellByPosition(2, 2)
oController.select(sCell)
If IsMissing( iRowIndex ) Then iRowIndex = oDoc.CurrentSelection.RangeAddress.StartRow
Dim oRow As Object : oRow = oSheet.Rows.getByIndex( iRowIndex )
Dim oRanges As Object : oRanges = oRow.queryContentCells(_
com.sun.star.sheet.CellFlags.VALUE OR _
com.sun.star.sheet.CellFlags.DATETIME OR _
com.sun.star.sheet.CellFlags.STRING OR _
com.sun.star.sheet.CellFlags.FORMULA)
Dim lColumn As Long
Dim lCount As Long : lCount = oRanges.getCount()
If lCount > 0 Then lColumn = oRanges.getByIndex( lCount - 1 ).RangeAddress.EndColumn + 1
Dim oCell As Object : oCell = oRow.getCellByPosition( lColumn + 1, 0 )
oController.select( oCell )
End Sub
Code: Select all
=HYPERLINK("vnd.sun.star.script:standard.scroll.scrolltoavailablecolumn?language=Basic&location=document"; "Click here to Scroll" )
How can I get this to work with Hyperlink?
Thanks