sort

J

Junior

Could someone direct me to the macro that sorts one column first and then
sorts another column based on first column sort. For example:
Before:
B1 1000
A1 1000
A2 1000
C1 1200
After:(numbers sorted first - then within number groups sorted by alphabet.)
C1 1200
A1 1000
A2 1000
B1 1000
 
J

J.E. McGimpsey

No macro required:

Choose Data/Sort and select the second column in the Sort by text
box (check the descending checkbox), and the second column in the
Then By text box (check the ascending checkbox).

If you really want a macro:

Range("A1").Sort Key1:=Range("B1"), _
Order1:=xlDescending, _
Key2:=Range("A1"), _
Order2:=xlAscending, _
Header:=xlGuess, _
MatchCase:=False
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top