title: Excel VBA Sort, error 1004 on .Apply
body: <p>I'm having issues using sort in VBA. I saw this thread for which <strong>the answers don't work for me</strong>: <a href="https://stackoverflow.com/questions/23140221/excel-1004-runtime-error-when-sorting-table">Sort in VBA</a></p>
  
  <p>I believe there is a maximum nr of records on which you can sort. Is that correct? I want to sort on 4 criteria in a sheet/table with <em>188,000</em> records. <br>
  I always get an error on the <code>.Apply</code> statement: <code>"run-time error '1004': application-defined or object-defined error"</code></p>
  
  <h3>Below my code:</h3>
  
  <pre><code>Sub Sort_Table()
  
      Dim sht As Worksheet
  
      Set sht = ActiveWorkbook.Worksheets("Sheet1")
  
      sht.Activate
  
      With sht.ListObjects("Table1").Sort
  
          .SortFields.Clear
          .SortFields.Add Key:=Range("Table1[Date]"), SortOn:=xlSortOnValues,    Order:=xlAscending ', DataOption:=xlSortNormal
          .SortFields.Add Key:=Range("Table1[Country Code]"), SortOn:=xlSortOnValues, Order:=xlAscending ', DataOption:=xlSortNormal
          .SortFields.Add Key:=Range("Table1[Rating]"), SortOn:=xlSortOnValues, Order:=xlAscending ', DataOption:=xlSortNormal
          .SortFields.Add Key:=Range("Table1[Segment]"), SortOn:=xlSortOnValues, Order:=xlAscending ', DataOption:=xlSortNormal
          .Header = xlYes
          .MatchCase = False
          .Orientation = xlTopToBottom
          .SortMethod = xlPinYin
          .Apply
  
      End With
  
  End Sub 
  </code></pre>