A3 cell has a checkbox.
D3 cell has a numeric value manually entered.
What i need is to set D3 value to negative when A3 checkbox is checked.
And that behavior must repeat on all lines above line 3 (D3:D).
This is the code i am trying to line 3, but it is not working:
function onEdit(A3) {
var ui = SpreadsheetApp.getUi();
var sheet = SpreadsheetApp.getActive().getSheetByName('APORTES');
var checkboxcell = "A3";
var valuecell = "D3";
var value = sheet.getRange(valuecell).getValue();
var negativevalue = value*(-1);
var type = sheet.getRange(checkboxcell).getValue();
if (tipo="RETIRADA") {
sheet.getRange(valuecell).setValue(negativevalue);
}
if (tipo="INVESTIMENTO") {
sheet.getRange(valuecell).setValue(value);
}
}
Aucun commentaire:
Enregistrer un commentaire