Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9782

Timestamp on multiple sheets in one workbook as well update the sheet if another sheet updated the one sheet

$
0
0

I have the following timestamp script in my workbook. The way it is written it is only updating the staff effort sheet.

https://docs.google.com/spreadsheets/d/17-75DRIfKICQYVE2MIUQ7ljZEs4GM-vJXEP4wAXmOgk/edit?usp=sharing

What I would like to have happen is the following.

  • If the project list sheet gets edited it will add a time stamp to colunm 22
  • if the staff effort sheets gets edited, it will add a timestamp to column 12
  • all other sheets will be ignored
function onEdit(e) {  let range = e.range;  let col = range.getColumn()  let row = range.getRow();  let sheetName = e.source.getActiveSheet().getName();  if (sheetName == 'Staff Effort'&& col != 50 && row > 12) {    let timestamp = Utilities.formatDate(new Date(),"GMT-5","M/d/yy h:mm a");    let sheet = e.source.getActiveSheet();    sheet.getRange(row,50).setValue(timestamp);  }}function onEdit(e) {  let range = e.range;  let col = range.getColumn()  let row = range.getRow();  let sheetName = e.source.getActiveSheet().getName();  if (sheetName == 'Project Tracking'&& col != 22 && row > 1) {    let timestamp = Utilities.formatDate(new Date(),"GMT-5","M/d/yy h:mm a");    let sheet = e.source.getActiveSheet();    sheet.getRange(row,22).setValue(timestamp);  }}

Viewing all articles
Browse latest Browse all 9782

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>