1

I am looking for a way to add a time stamp to the last row of a column of figures any time there is a change in the above range. I have been able to find a number of examples where you can timestamp the next or last column but none for monitoring a column range and time stamping below. I am trying to get this working across multiple column with the answer showing in the same row of each.

3

1 Answer 1

1

I've modified the code from my answer to fit your description. In the example below, columns 2-5 (that is, B-E) of sheet named 'Sheet1' are monitored for changes. In case of change, a timestamp is inserted in the last row of that column.

To customize: change the sheetname and column bounds on line 4 of the script. If a non-contiguous range of columns is to be watched (e.g., columns 2,4,7,8), replace the conditions column >= 2 && column <= 5 with, for example, [2, 4, 7, 8].indexOf(column) > -1

function onEdit(e) {
  var sheet = e.range.getSheet();
  var column = e.range.getColumn();
  if (sheet.getSheetName() == 'Sheet1' && column >= 2 && column <= 5) {
    var row = sheet.getMaxRows();
    sheet.getRange(row, column).setValue(new Date());
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.