ich will den Fokus auf die letzte Zelle mit Daten zu setzen mittels eines Python-Makro.
Also "Ctrl + End":
Code Basic
Code: Alles auswählen
REM ***** BASIC *****
Sub Main
End Sub
sub Macro1
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 = "Sel"
args1(0).Value = false
dispatcher.executeDispatch(document, ".uno:GoToEndOfData", "", 0, args1())
end sub
Code: Alles auswählen
########################
## FOCUS ON LAST DATA ##
########################
def setFocusToEndOfUsedArea(controller, sheet, cursor):
cursor.gotoEndOfUsedArea(False)
address = cursor.RangeAddress
cell = sheet.getCellByPosition(address.EndColumn, address.EndRow)
controller.select(cell)
Was muss da noch konfiguriert werden?