I have a Google Sheet with a dropdown menu in column U.I would like column V to timestamp when column U is changed. I've used the following code however this only timestamps the first time that column U is changed, not any subsequent time when the drop-down is changed.
Any suggestions for how to make this work?
function onEdit() {
var s = SpreadsheetApp.getActiveSheet();
if( s.getName() == "Sheet1" ) { //checks that we're on the correct sheet
var r = s.getActiveCell();
if( r.getColumn() == 21 ) { //checks the column
var nextCell = r.offset(0, 1);
if( nextCell.getValue() === '' ) //is empty?
var time = new Date();
time = Utilities.formatDate(time, "GMT", "HH:mm:ss");
nextCell.setValue(time);
};
};
}