--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/84159c69-469d-4123-a5de-bfdd06afe7d2o%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/84159c69-469d-4123-a5de-bfdd06afe7d2o%40googlegroups.com.
I don’t think you need another if statement, what you have is enough, I just merged the 2 onEdit functions into 1 for you.
Replace your 2 onEdit functions with this:
function onEdit(e) {
var ss = e.source;
var activatedSheetName = ss.getActiveSheet().getName();
var activatedCell = ss.getActiveSelection();
var activatedCellRow = activatedCell.getRow();
var activatedCellColumn = activatedCell.getColumn();
var activatedCellValue = activatedCell.getValue();
var Pipeline = ss.getSheetByName("Pipeline"); // source sheet
var Success = ss.getSheetByName("Success"); // target sheet
var Loss = ss.getSheetByName("Loss"); // target sheet
// if the value in column D is "Success", move the row to target sheet
if (activatedSheetName == Pipeline.getName() && activatedCellColumn == 9 && activatedCellValue == "Success")
{
// insert a new row at the second row of the target sheet
Success.insertRows(2,1);
// move the entire source row to the second row of target sheet
var rangeToMove = Pipeline.getRange(/*startRow*/ activatedCellRow, /*startColumn*/ 1, /*numRows*/ 1, /*numColumns*/ Pipeline.getMaxColumns());
rangeToMove.moveTo(Success.getRange("A2"));
// delete row from source sheet
Pipeline.deleteRows(activatedCellRow,1);
}
// if the value in column D is "Loss", move the row to target sheet
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/72179420-3bb9-43fb-b33b-3ce26c09ad37n%40googlegroups.com.