title: How to get cell location whose value is changed with reference to other cell value in Google Apps Script
body: <p>I have sheet in which whenever there is an edit, for example in cell &quot;A1&quot;, the background color of this cell will be changed to green. I am using on edit trigger. This works when I manually enter value in cell &quot;A1&quot;.</p>
  <p>But if this cell is connected with another cell &quot;B2&quot; and any change in &quot;B2&quot; cell will automatically change value in cell &quot;A1&quot; but when it happens, the background color does not change. I think it is because I did not edit value manually. Is there any way that we can change background color of cell &quot;A1&quot; whenever it's value is changed due to another cell? Hope you got the point. I am using following script. Any help would be appreciated.</p>
  <pre><code>function HighlightCell() {
  
    var Sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(&quot;Sheet1&quot;);
    var cell  = Sheet.getActiveCell();
   
    Logger.log(cell);
   
    SpreadsheetApp.flush();
    cell.setValue(&quot;Highlighted&quot;);
    
    SpreadsheetApp.flush();  
    cell.setBackground(&quot;green&quot;);
  }
  </code></pre>