[Solved] Select a particular cell after a macro is executed

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
DUNDUMON
Posts: 8
Joined: Fri Nov 25, 2016 11:31 am

[Solved] Select a particular cell after a macro is executed

Post by DUNDUMON »

Code: Select all

Sub main
oCtrl = ThisComponent.CurrentController
oCtrl.Select(oCtrl.ActiveSheet.GetCellRangeByName("B3:B9"))
ThisComponent.getCurrentSelection.ClearContents(23)
End Sub
Code credits : @einstein

i use push button to execute this function. My question is how will i select cell B1 after executing this code.
Last edited by DUNDUMON on Sat Nov 26, 2016 10:36 am, edited 1 time in total.
Open Office 4.1.3
User avatar
Zizi64
Volunteer
Posts: 11363
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Select a particular cell after a macro is executed

Post by Zizi64 »

Sub main
oCtrl = ThisComponent.CurrentController
oCtrl.Select(oCtrl.ActiveSheet.GetCellRangeByName("B3:B9"))
ThisComponent.getCurrentSelection.ClearContents(23)
End Sub


Code credits : @einstein

i use push button to execute this function. My question is how will i select cell B1 after executing this code.
??????????????? :shock:
Maybe I do not understand your question... Or maybe you have not too much knowledge about macro programming...
Einstein's example code contains the 'commands' how to select a cellrange (or a single cell) by macro.

Code: Select all

Sub main
oCtrl = ThisComponent.CurrentController
oCtrl.Select(oCtrl.ActiveSheet.GetCellRangeByName("B3:B9"))
ThisComponent.getCurrentSelection.ClearContents(23)

oCtrl.Select(oCtrl.ActiveSheet.GetCellRangeByName("B1"))
End Sub
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Post Reply