Advertisement
RemcoE33

timestamp

Jul 2nd, 2021
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function onEdit(e) {
  2.   const row = e.range.getRow();
  3.   const col = e.range.getColumn();
  4.   if ([1,2].includes(col) && row >= 6 && e.source.getActiveSheet().getName() == "Data") {
  5.     const offsetValue = e.range.offset(0,(col == 2) ? -1 : 1 ).getValue()
  6.     if (offsetValue === 0 && Number(e.value) === 0) {
  7.       const currentDate = new Date();
  8.       e.range.offset(0,(col == 2) ? 2 : 3 ).setValue(currentDate);
  9.     }
  10.   }
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement