EXCELsortingVBA – sorting外面

这是工作:

Columns("A:L").Sort Key1:=Range("L1"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom 

我需要:

 Columns("A:L").Sort ***Key1:=Range("W1")***, Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom 

正常生成错误! 我不想Columns("A:W").Sort

我需要通过使用VBA在W1上的值来sortingA:L。

那么从逻辑上来说,按列WsortingA:L是不太可能的,在sorting中包括列W。 如果你这样做,你可以重复相同的sorting过程和A:L再次洗牌成不同的顺序!
所以,唯一看似合理的事情就是把A:L,W:Wsorting,但是Excel不能做到这一点(在我知道的版本中只有一个连续的区域)。 唯一的解决办法:复制L旁边的W:W并sortingA:M。