Google Spreadsheet: run script on cell value change
<p>In a spreadsheet I have two sheets, * and <strong>Calculator</strong>. When I change the value on "*"!B1 (<em>i.e. cell B1 of sheet</em> *), I want to run the script: to change (actually clear) the value of "Calculator"!B3 (<em>i.e. cell B3 of sheet "Calculator"</em>).</p>

<p>Here's my code. I created it through Spreadsheet > Tools  > Script editor, so it's not an standalone:</p>

<p><em>The difference between Version 1 and 2 is that in <strong>Version 1</strong> the <strong>first function is run</strong> and the <strong>second is missed</strong> (vice versa in Version 2), plus one thing I'll detail below.</em></p>

<h2>Version 1</h2>

<pre><code>function onEdit(e) {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var languageSheet = ss.getSheetByName("*").getSheetName();
  var languageCell = languageSheet.getRange("B1");
  var sheets = ss.getSheets()[0];
  var languageCellCheck = sheets.getActiveCell();
  var cookingMethodSheet = ss.getSheetByName("Calculator").getSheetName();
  var cookingMethodCell = cookingMethodSheet.getRange("B3");
  var range = e.range;

  if (range == languageCell)
    cookingMethodCell.setValue("A");
}

//function onEdit(e) {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var languageCell = ss.getSheetByName("*").getRange("B1");
  var sheets = ss.getSheets()[0];
  var languageCellCheck = sheets.getActiveCell();
  var cookingMethodCell = ss.getSheetByName("Calculator").getRange("B3");
  var range = e.range;

  if (range == languageCell)
    cookingMethodCell.setValue("A");
//}
</code></pre>

<h2>Version 2</h2>

<pre><code>//function onEdit(e) {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var languageSheet = ss.getSheetByName("*").getSheetName();
  var languageCell = languageSheet.getRange("B1");
  var sheets = ss.getSheets()[0];
  var languageCellCheck = sheets.getActiveCell();
  var cookingMethodSheet = ss.getSheetByName("Calculator").getSheetName();
  var cookingMethodCell = cookingMethodSheet.getRange("B3");
  var range = e.range;

  if (range == languageCell)
    cookingMethodCell.setValue("A");
//}

function onEdit(e) {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var languageCell = ss.getSheetByName("*").getRange("B1");
  var sheets = ss.getSheets()[0];
  var languageCellCheck = sheets.getActiveCell();
  var cookingMethodCell = ss.getSheetByName("Calculator").getRange("B3");
  var range = e.range;

  if (range == languageCell)
    cookingMethodCell.setValue("A");
}
</code></pre>

<hr>

<p>When I say "Version 1" I mean I changed the value of "*"!B1 from "Something" to "Whatever", and cell "Calculator"!B3 wasn't changed. Then, using Version 2, I tried the same but got the same result (no change in B3).</p>

<p>The idea of having two functions (same for both versions) is because I don't know if using <code>ss.getSheetByName("Calculator").getSheetName();</code> or directly selecting in as in <code>ss.getSheetByName("*").getRange("B1");</code> will make a difference. Apparently, it doesn't.</p>

<p>What's and where's the error?</p>