In Calc, I need to push a button and have a cell value making 1, how do I do it?
Here a workaround without macro: You can make a fake button by using a check-box and an image.
- View > Toolbars > Form Controls. Insert a check box.
- Right-click the check box > Control…
- In tab Data enter the cell address e.g. B2 in field
Linked cell
- In tab General go to field Graphics. Click on the
...
button and select an image.
The entire area of the control is click-sensitive. You only need to design a graphic, which looks like a button.
The value in the linked cell will toggle between TRUE and FALSE with each click. LibreOffice has no separate logical data type but interprets TRUE as 1 and FALSE as 0 in Spreadsheets formulas.
If you need other values in the linked cell, you can set it in tab Data in the fields Reference value (on)
and Reference value (off)
. But it is always a text, even if you enter 1 and it looks like a number.
For a true Push Button you need a macro, that writes the value into the cell. You can then bind the macro e.g. to the “Execute action” event in the tab Events.
Thank you! This works if I want the cell to add +1? I mean the cell value is 3, when I push the button the cell need to become 4, then 5,…
I would like to make my sports stats (shots,…)
For that you really need a macro. The normal behavior of a spreadsheet is, that the formulas in the cells pull the values from other cells. You cannot push a value into a cell.
Thank you again for the prompt answer. I Always worked with normal formulas and sheets, but I am really not good with macros. I keep trying, and I try to learn as well but I really have troubles to write a macro for this thing (even if probably what I need to do is really easy)