title: Google spreadsheet Script - iterate on rows of active selection, but all columns
body: <p>I have read many similar questions but I still can't get my code to work and I believe this is because of a slight difference in what I want to achieve :</p>
  
  <p>I want to perform iterations on the rows that correspond to the currently selected cells (I don't care about the cells themselves, just about their row). I also need to reach cells that are outside the current selection, but in the same row.</p>
  
  <p>Eg suppose I select A2:A3 in my spreadsheet, then I want to "recognize" I'm on rows 2 and 3, and perform operations like</p>
  
  <pre><code>E2 = A2 + B2 + C2 * D2
  E3 = A3 + B3 + C3 * D3
  </code></pre>
  
  <p>So far I was trying something like this but it doesn't seem to work</p>
  
  <pre><code>function myfunction(){
    var range = sheet.getActiveRange()
    var firstRow = range.getRow()
    var numRows = range.getNumRows();
  
    for (var i = 0; i &lt; numRows; i++) {
      var absoluteRow = firstRow + i
  </code></pre>
  
  <p>NOTE : actually I believe the script itself is good, but the way I activate it is maybe the problem :</p>
  
  <p>I generate a new menu item "MyFunction" in the top toolbar, and I attached my function to this menu item, but is it passing the activeRange correctly ?</p>
  
  <pre><code>SpreadsheetApp.getUi()
    .createMenu("MyMenu")
    .addItem("MyFunction","myFunction")
    .addToUi()
  </code></pre>