0
我得到了一個錯誤爲Sort method out of range
。在開始時我得到了同樣的錯誤,並且在我的代碼增強之後,我再也沒有看到這個錯誤。錯誤的'排序方法超出範圍'在VBA
現在它再次顯示執行時出現同樣的錯誤。這不是有效的編碼方式嗎?
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