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

Add a date stamp when a new row is added from another tab

$
0
0

I have been trying this for a few hours. I would like a date stamp inserted on column K when a new row is added (my data is on another sheet). I currently have the script below, however, it only works when I edit column 4 manually and not when the row is moved. I want the date stamp to be put when a new row is added. Could you please help me around this?

function onEdit() {  var s = SpreadsheetApp.getActiveSheet();    if( s.getName() == "Marketing Dept" ) { //checks that we're on Sheet1 or not  var r = s.getActiveCell();    if( r.getColumn() == 4 ) { //checks that the cell being edited is in column D  var nextCell = r.offset(0, 7);    if( nextCell.getValue() === '' ) //checks if the adjacent cell is empty or not?nextCell.setValue(new Date());}}}

Viewing all articles
Browse latest Browse all 9788

Latest Images

Trending Articles



Latest Images

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