0

This is working:

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

I need to:

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

Is normal to generate error! I don't want to Columns("A:W").Sort!

I need to sort just A:L by values on W1 using VBA.

1 Answer 1

2

Well, logically it is improbable that sorting A:L by Column W makes sense, without including column W in the sorting. If you do so, you can repeat the same sorting process and A:L are shuffled again into a different order!
So, the only seemingly reasonable thing is to sort A:L,W:W, but Excel cannot do this (only one contiguous area, in the versions I know). Only solution: copy W:W next to L and sort A:M.

Sign up to request clarification or add additional context in comments.

1 Comment

Hi, great that it helps. So, then please mark (accept) the answer so others can see that the issue has been solved (and I get some points, too :) ).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.