title: sort multiple columns excel VBA
body: <p>this is my code </p>
  
  <pre><code>Sub SortMultipleColumns(myline As String)
  
      With Worksheets("Result-Inactive").Sort
          .SortFields.Add Key:=Range("A1"), Order:=xlAscending
          .SortFields.Add Key:=Range("D1"), Order:=xlAscending
          .SortFields.Add Key:=Range("J1"), Order:=xlAscending
          .SetRange Range("A1:C" &amp; myline)
          .Header = xlYes
          .Apply
      End With
  
  End Sub
  </code></pre>
  
  <p>I get the following error and I dont undertsand why "Run time error '1004' the sort reference is not valid. MAke sure that it is within the daya you want to sort, and then first Sort by Box isnt the same or blank. when I click debug. The .apply gets higlighted </p>
  
  <p>any suggestions?</p>