0

Currently, I am using below code to update timestamp in the next column. But I want to modify the code to update timestamp only when the cell value is True not on a change of cell value.

function onEdit(e) {
  if(e.source.getActiveSheet().getName() == "Daily" ) {
    var col = e.source.getActiveCell().getColumn();
    if(col == 13 || col == 15 || col == 17) {
      var nCell = e.range.offset(0,1);   
      if(nCell.getValue() == "" && e.value != "") {
        var time = Utilities.formatDate(new Date(), "GMT+3", "HH:MM:SS");
        nCell.setValue(time);
      } else if(nCell.getValue() != "" && e.value == "") { 
        nCell.setValue("");
      }
    }
  }    
}
  • Welcome! Seems to me you just need another if to allow continued execution only when that cell is True—but I don't know Action Script. Consider revising your question. What have you tried? How far did you get? What didn't work? – Joel Reid Mar 15 at 0:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.