This is an old revision of the document!
This describes how to write some code and setup your worksheet to perform a certain action when a button is pressed.
View→Toolbars→Form controls
Go into design mode (This disables any button functions) Select from the form controls Push Button
Draw this button in a cell.
Change the label to something meaningful to the user:
All buttons will be useless to a user of the spreadsheet if the design mode is active. To change from design mode to active mode two more steps are required:
Paste code below into: Tools→Macros→Organize Macros→LibreOffice.org Basic…
Sub telop Dim oCell_1,oCell_2,Cell oCell_1 = thisComponent.Sheets(0).getCellRangeByName("A2") oCell_1.Value = 100 oCell_2 = thisComponent.Sheets(0).getCellRangeByName("A3") oCell_2.Value = 200 Cell = thisComponent.Sheets(0).getCellByPosition(0, 3) Cell.Formula = "=SUM(A2:A3)" End Sub