title: Performing Actions after a loop
body: <p>GoogleAppScript working in GoogleSheets</p>
  
  <p>Following code is working fine until I try to perform any action after the loop. It correctly logs the row which has "----CUT HERE----" as it's value. But after logging the row number I can not get it to perform next task. What am I missing?</p>
  
  
  
  <pre class="lang-js prettyprint-override"><code>function FORMATKPIREPORT() {
    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var sheet = ss.getActiveSheet();
    var dataRange = sheet.getDataRange();
    var values = dataRange.getValues();
  
    for (var i = 0; i &lt; values.length; i++) {
    for (var j = 0; j &lt; values[i].length; j++) {
    if (values[i][j] == "----CUT HERE----") {
    var cuthere = i+1;Logger.log(cuthere);return i+1;
    }
    }
    }
  
    var lastrow = sheet.getLastRow();
    Logger.log(lastrow);
  
  }
  </code></pre>
  
  <p>Now that I know what the CutHere row is I want to find the LastRow.</p>