1

I would like to be able to limit the range of cells being assessed by this script to the first column. Apply the timestamp to the last column and only have the script run on a specific sheet "Short Sale/REO Pricing".

function onEdit() {
  var s = SpreadsheetApp.getActiveSheet();
  var r = s.getActiveCell();

  // check the column
  if( r.getColumn() != 2 ) { 
    var row = r.getRow();
    var time = new Date();
    time = Utilities.formatDate(time, "GMT-08:00", "MM/DD/yy, hh:mm:ss");
    SpreadsheetApp.getActiveSheet().getRange('B' + row.toString()).setValue(time);
  };
};

Any ideas?

1 Answer 1

2

This needs testing but something like this:

change

  if( r.getColumn() != 2 ) { 

to:

  if( r.getColumn() == 2 && s.getName() == "Short Sale/REO Pricing" ) { 

test the above, then change:

    SpreadsheetApp.getActiveSheet().getRange('B' + row.toString()).setValue(time);

to:

  SpreadsheetApp.getActiveSheet().getRange(row, s.getLastColumn()).setValue(time);

The google-apps-script is "javascript".

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.