title: I used google script editor to set up a structure where a row was deleted & transferred to diff sheet based on checkboxes. Some rows are disappearing
body: <p>Hi I'm a complete newbie when it comes to google scripts so any help is appreciated. The script is working fine, however some rows are disappearing (getting deleted) and not being moved to the second sheet. Can anyone help out.</p>
  <p>Script used:</p>
  <pre><code>        function onEdit(event) {// assumes source data in sheet named main
    // target sheet of move to named Completed
    // getColumn with check-boxes is currently set to column 4 or D
    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var s = event.source.getActiveSheet();
    var r = event.source.getActiveRange();
  
    if(s.getName() == &quot;Acquisition&quot; &amp;&amp; r.getColumn() == 1 &amp;&amp; r.getValue() == true) {
      var row = r.getRow();
      var numColumns = s.getLastColumn();
      var targetSheet = ss.getSheetByName(&quot;FirstTraining&quot;);
      var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
      s.getRange(row, 1, 1, numColumns).moveTo(target);
      s.deleteRow(row);
    } else if(s.getName() == &quot;FirstTraining&quot; &amp;&amp; r.getColumn() == 1 &amp;&amp; r.getValue() == false) {
      var row = r.getRow();
      var numColumns = s.getLastColumn();
      var targetSheet = ss.getSheetByName(&quot;Acquisition&quot;);
      var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
      s.getRange(row, 1, 1, numColumns).moveTo(target);
      s.deleteRow(row);
    }
    if(s.getName() == &quot;FirstTraining&quot; &amp;&amp; r.getColumn() == 2 &amp;&amp; r.getValue() == true) {
      var row = r.getRow();
      var numColumns = s.getLastColumn();
      var targetSheet = ss.getSheetByName(&quot;Incubation&quot;);
      var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
      s.getRange(row, 1, 1, numColumns).moveTo(target);
      s.deleteRow(row);
    } else if(s.getName() == &quot;Incubation&quot; &amp;&amp; r.getColumn() == 2 &amp;&amp; r.getValue() == false) {
      var row = r.getRow();
      var numColumns = s.getLastColumn();
      var targetSheet = ss.getSheetByName(&quot;FirstTraining&quot;);
      var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
      s.getRange(row, 1, 1, numColumns).moveTo(target);
      s.deleteRow(row);
    }
    if(s.getName() == &quot;Incubation&quot; &amp;&amp; r.getColumn() == 3 &amp;&amp; r.getValue() == true) {
      var row = r.getRow();
      var numColumns = s.getLastColumn();
      var targetSheet = ss.getSheetByName(&quot;Graduated&quot;);
      var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
      s.getRange(row, 1, 1, numColumns).moveTo(target);
      s.deleteRow(row);
    } else if(s.getName() == &quot;Graduated&quot; &amp;&amp; r.getColumn() == 3 &amp;&amp; r.getValue() == false) {
      var row = r.getRow();
      var numColumns = s.getLastColumn();
      var targetSheet = ss.getSheetByName(&quot;Incubation&quot;);
      var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
      s.getRange(row, 1, 1, numColumns).moveTo(target);
      s.deleteRow(row);
    }
  }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/5hB2m.png" rel="nofollow noreferrer">enter image description here</a></p>
  <p>It works fine when clicked one by one but bulk clicks dont get moved and rows are disappearing randomly</p>