mardi 21 mars 2017

Google Sheets +1 button if specific text in cell

I've looked everywhere but couldn't manage to find the script I was looking for...

I'm using google sheets and I would like to add +1 when I click on an "OK" button (that I've made already) into a specific cell according to the text that is in another cell.

I've tried adding; "if ("P8" == "text")" before the function but nothing happens...

Here is my script:

function modifyCell(cellName, increase) {
var range = SpreadsheetApp.getActiveSheet().getRange(cellName);
var toAdd = -1;
if (increase) {
toAdd = 1;
}
range.setValue(range.getValue() + toAdd);
}

function increaseLine24() {

if ("P7" == "country")
{
modifyCell("R8", true);
}
}

Thank you in advance for your help

Aucun commentaire:

Enregistrer un commentaire