I have been using a script like this
function incrementB2(){
SpreadsheetApp.getActiveSheet().getRange('B2').setValue(SpreadsheetApp.getActiveSheet().getRange('B2').getValue() + 1);
}
I was hoping to be able to have the code grab the location/cell it is in and use that location or to be able to send a variable through the assign code such as.
function increment(CellName){
SpreadsheetApp.getActiveSheet().getRange(CellName).setValue(SpreadsheetApp.getActiveSheet().getRange(CellName).getValue() + 1);
}
and then assign increment("B2") so that I can use the same script for multiple cells. Are either of these methods possible or is there some other way to not have to create incrementB2, incrementB3, incrementB4 functions?