title: In ClosedXML, how to sort a worksheet by a column?
body: <p>In C# using asp/MVC the app generates an Excel .xlsx file based on data thats filled in to the specific columns, works great.</p>
  
  <p>But the goal is to provide additional worksheets that use the same columns but sort on specific colums, such as Column "J"</p>
  
  <pre><code>  var wb = new XLWorkbook();
    var ws = wb.Worksheets.Add("Proj Info");
    var ws2 = wb.Worksheets.Add("Sort By Dates");
  </code></pre>
  
  <p>The worksheet ws has values filled in by variables or formulas, the data is correct, but cannot make it sort on a column</p>
  
  <pre><code>  ws.AutoFilter.Column("J");   //no, nothing changes
    ws.Column("J").Sort(); -&gt; this shifts all the columns up but does not sort
    ws.Column("J").Sort(XLSortOrder.Ascending);  -&gt;same, doesnt sort only shifts
  </code></pre>
  
  <p>Update:  ws.Sort(9); worked in sorting, but the problem is that Column 10 has a Formula, and I need to sort on that Column.</p>
  
  <pre><code>   ws.Cell("J" + c).FormulaR1C1 = "=C$2-F" + c;
  </code></pre>
  
  <p>With this?  it WILL NOT SORT. The ws.Sort(10); works when the cell contains a final value, but when its got the Formula?  Is there any workaround to force the Excel page to sort after its implemented the formula's in each cell?</p>