I got an error as Sort method out of range
. At the beginning I got the same error, and after the enhancement of my code I haven't seen this error any more.
Now again it's showing the same error when I execute. Is the not the effective way of coding ?
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