vendredi 11 novembre 2022

How to add two actions to a script / work simultaneously

I have tried time and time again to utilize this same script & formatting to try to also get the "lost" checkbox to move to the "lost" tab (on the same script) and I've been at a loss. Any help on how to get two identical actions/scripts to work simultaneously? My current script allows the checkbox for "sold" to go in a "sold" tab, and i need the same for "lost" if that makes sense.

function onEdit(e) {
  let sheet;
  if (e.range.columnStart !== 9
    || e.range.rowStart === 2
    || !(sheet = e.range.getSheet()).getName().match(/^(Cynthia|Jenni|Kelsi|Monte)$/i)) {
    return;
  };
  const targetSheet = SpreadsheetApp.getActive().getSheetByName('Sold');
  const targetRange = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
  sheet.getRange(e.range.rowStart, 1, 1, 8).moveTo(targetRange);
  sheet.deleteRow(e.range.rowStart);
}



Aucun commentaire:

Enregistrer un commentaire