First create a script to increment the cell value. For instance, to increment cell "A1" by one the following script would work:
function increment() {
SpreadsheetApp.getActiveSheet().getRange('A1').setValue(SpreadsheetApp.getActiveSheet().getRange('A1').getValue() + 1);
}
Save this script and open your spreadsheet and follow these steps:
- Go to "Insert" > "Drawing" and draw a button using shapes and text.
- Position your button accordingly, and right-click on it to display an
arrow on the side of it.
- In the drop-down menu, select "Assign Script." and type the name of
your function. (In this case "increment")
- The first time when you click on it, it'll ask for permission but
should work subsequently.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…