title: Error message: "range is not defined" when creating a sorting script
body: <p>Im trying to use part of the code from <a href="https://gist.github.com/mikebranski/285b60aa5ec3da8638e5#file-keep-column-sorted-in-google-sheets-gs" rel="nofollow noreferrer">this auto-sorting script</a> to make a script that when you press a button on the spreadsheet, it sorts the list.
  However, I keep getting an error message: &quot;ReferenceError: range is not defined&quot;</p>
  <p>Here is the code:</p>
  <pre><code>var SORT_COLUMN_INDEX = 1;
  var ASCENDING = false;
  var NUMBER_OF_HEADER_ROWS = 9;
  range = range.offset(NUMBER_OF_HEADER_ROWS, 0);
  
  function sortID(sheet) {
    var data = SpreadsheetApp.getActive().getSheetByName(&quot;Report Log&quot;);
    range.sort( {
      column: SORT_COLUMN_INDEX,
      ascending: ASCENDING
    } );
  }
  </code></pre>
  <p>Also I should probably mention im really new to scripting in google sheets.</p>