Description
You would need to create a function in script editor like the one I have shown below.
After assigning this function to the button, when the user presses the button the value in cell A1 is incremented and placed back in cell A1.
I may be long winded in using SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getRange("A1")
but that's the way I like to do it.
The Script Editor is available from the menu bar Extensions -> App Script.
Another way to use the button function is, if the button is in cell B1 and the cursor is in cell H22 (random), the active cell is the selected cell H22 and the value in H22 will be incremented.
Script (original)
function buttonFunction() {
let range = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getRange("A1");
let value = range.getValue();
value++;
range.setValue(value);
}
Script (modified)
function buttonFunction() {
let sh = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
let range = sh.getActiveCell();
let value = range.getValue();
value++;
range.setValue(value);
}
Reference