Sorry to ask what is probably a blindingly obvious question to most. Over the years I have constructed a large spreadsheet and now have the need to use a basic macro to jump to a specific cell in a specific sheet using a basic macro. This works as I have recorded the macro code:
Sub Find()
dim document as object
dim dispatcher as object
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Nr"
args1(0).Value = 3
dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0, args1())
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "ToPoint"
args2(0).Value = "$H$5" 'Cell Coordinates String
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args2())
End Sub
…but I need to replace the $H$5
with a numerical cell reference like (7,4)
. I can reference a cell and access its contents simply with Cell=Sheet(2).getCellByPosition(8,14)
having set up the sheet previously. The numbers for the index are generated elsewhere in the macro but I need to jump to the location and open the worksheet preferably using simple code like the last example. Help, please.