I have a bunch of cells with numbers in them. I want them to secure them in a way that I can only add +1 to them. Now I do this manually (4 becomes 5 etc.etc.).
Assuming Google Spreadsheets doesn't have nifty up/down arrow for a cell increasing/decreasing +1 / -1, I think I'm supposed to use a script.
Something like this
function increment() { SpreadsheetApp.getActiveSheet().getRange("F5").setValue(SpreadsheetApp.getActiveSheet().getRange("F5").getValue() + 1);
}
But if I'm using this script (creating numerous drawings (grrr) ), I'm supposed to create x of the same functions? Seems a bit dumb.
This gives me errors
function increment(mycell) { SpreadsheetApp.getActiveSheet().getRange(mycell).setValue(SpreadsheetApp.getActiveSheet().getRange(mycell).getValue() + 1);
}
Usage: increment(F5)
Error: function increment(F5) not found.
?
Sheet formulas are by default recalculated, so should you type into a cell a formula that increments the value in another cell by 1
- once the value increases, this will trigger the formula recalculation and request the value to increase again and so on.
So you cannot implement your idea in this way
Workaround
Sample function:
function increment() {
SpreadsheetApp.getActiveSheet().getCurrentCell().setValue(SpreadsheetApp.getActiveSheet().getCurrentCell().getValue() + 1);
}
To create a button:
Insert->Drawing
Save and close
Assign script
()
)