function onEdit(e) {
var ss = e.source.getActiveSheet();
if
(ss.getName() !==
'sheet1'
|| e.range.columnStart !==
2
)
return
;
e.range.offset(
0
, -
1
)
.setValue(e.value ?
new
Date() :
null
);
}
Or if you want to have it on a couple of sheets you could use
function onEdit(e) {var ss = e.source.getActiveSheet();if (ss.getName() == 'sheet1' && e.range.columnStart == 2) {e.range.offset(0, -1).setValue(e.value ? new Date() : null);}else if (ss.getName() == 'sheet3' && e.range.columnStart == 2){e.range.offset(0, -1).setValue(e.value ? new Date() : null);}else if (ss.getName() == 'sheet5' && e.range.columnStart == 2){e.range.offset(0, -1).setValue(e.value ? new Date() : null);}else {return;}}
No comments:
Post a Comment