title: Error 'sort method out of range' in vba
body: <p>I got an error as <code>Sort method out of range</code>. At the beginning I got the same error, and after the enhancement of  my code I haven't seen this error any more. </p>
  
  <p>Now again it's showing the same error when I execute. Is the not the effective way of coding ?</p>
  
  <pre><code>With Master_workbook.Worksheets("warehouse")
  
           'Last row and last column in worksheet("warehouse")
  
              Ws1_Lrow = .Cells.Find("*", .Range("A1"), xlFormulas, , xlByRows, xlPrevious).Row
              Ws1_Lcol = .Cells.Find("*", .Range("A1"), xlFormulas, , xlByColumns, xlPrevious).Column
              Set rngFilter = .Range(.Cells(1, 1), .Cells(Ws1_Lrow, Ws1_Lcol))
  
                  Selection.Sort Key1:=Range("W2"), Order1:=xlDescending, Header:=xlGuess, OrderCustom:=1, Orientation:=xlTopToBottom
  
              Master_workbook.Worksheets("warehouse").Columns("Z:Z").Cut
              Master_workbook.Worksheets("warehouse").Columns("U:U").Insert Shift:=xlToRight 
  end with
  </code></pre>