Reputation: 1
Need some help with this script. Only one of the desired date stamps is working. Right now data entry in column 19 prompts a date stamp in column 20, however nothing happens in column 14 when data is entered in column 13.
function onEdit(e) {
var sh = e.source.getActiveSheet()
var colToWatch = 13
var colToStamp = 14
var colToWatch = 19
var colToStamp = 20
if (sh.getName() !== 'Pending Orders'
|| e.range.columnStart != colToWatch
|| e.range.rowStart < 4) {
return;
}
sh.getRange(e.range.rowStart, colToStamp)
.setValue(new Date())
}
Thank you
Upvotes: 0
Views: 296
Reputation: 38140
The code is overwriting the previously assigned values (there two lines var colToWatch
and two var colToStamp
)
You should use different variables names on each var
code lines and to change if
condition accordingly.
Related
Upvotes: 1