title: Google Spreadsheets Script not Working if Values are Entered Quickly
body: <p>I have written a following script for my Google Spreadsheet:</p>
  
  <pre><code>function onEdit(e) 
  {
    var doc = SpreadsheetApp.getActiveSpreadsheet();
    var sheet = doc.getActiveSheet();
    var cell = sheet.getActiveCell();
    var column = sheet.getActiveCell().getColumn();
    var row = sheet.getActiveCell().getRow();
    var dat = sheet.getActiveCell().getValue()+"";
    var curDate = Utilities.formatDate(new Date(), "GMT+5:30", "dd/MM/yyyy")
    var editor = doc.getViewers();
    var temp = e.oldValue;
    if(dat=="")
    {
      dat = "0.0"
    }
    if((column == 4 || column == 5) &amp;&amp; temp != null)
    {
      cell.setComment("Value changed from ₹"+ (temp) + " to ₹" + dat + " on " + curDate);
    }
  
  }
  </code></pre>
  
  <p>I use this code to insert a comment when a value is changed in the column D or E. I am using this script since a month and the code works perfect. But I recently noted an issue with it.</p>
  
  <ol>
  <li>If I enter values quickly in several cells, for example, D2, D3, D4, D5, D6 etc., the code is not executed for all cells and comment is added to some random cells only. It is executed as expected only when I keep minimum interval of 1 second between entering records.</li>
  <li>If I delete values from multiple cells at once, the code is not executed for any cell.</li>
  </ol>
  
  <p>Thanks for reading the code. </p>