I am trying to clear the cell in 'column J' upon the change of the corresponding cell in "column I".
it's only effective when I change the cell value by myself manually but the data is a result of filter and when it changes it doesn't work even though I made a trigger for the script.
Here's what I have so far:
function onEdit() {
var s = SpreadsheetApp.getActiveSheet();
if( s.getName() == "con" ) {
var r = s.getActiveCell();
if( r.getColumn() == 9 ) {
var nextCell = r.offset(0, 1);
nextCell.setValue("");
}
}
}
You can also write the code like this if you use the event object:
function onEdit(e) {
const sh = e.range.getSheet();
if(sh.getName() == "con" && e.range.columnStart == 9) {
e.range.offset(0,1).setValue("");
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.