I'm an absolute rookie - so I appreciate any insight/ suggestions on where I'm (obviously going wrong)
I have a sheet where I'm trying to get a date stamp in column B when the same row is edited (apart from column B) I would like the date stamp to be in the same row as the row that's being edited.
I've had a bash at the script (and failed)
I have 2 x onEdit functions, so the trigger would have to be myFunction etc
Below is the attempted script:
FYI - the data in the sheet is from column B11 to AQ
function myFunction(e)
{
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName('Position Activity'); //
{
var actRng = sheet.getActiveRange();
var editColumn = actRng.getColumn();
var rowIndex = actRng.getRowIndex();
var headers = sheet.getRange(1, 1, 1, sheet.getLastColumn()).getValues();
var dateCol = headers[0].indexOf(1) + 1;
var orderCol = headers[0].indexOf(23) + 1;
if (dateCol > 0 && rowIndex > 1 && e.range.columnStart > 1)
{
sheet.getRange(rowIndex, dateCol).setValue(Utilities.formatDate(new Date(), "CET",
"dd-mmm-yyyy"));
}
}
}
Thanks in advance