VBA: Sort on two columns

gio123bg

Active Member
Joined
Feb 14, 2004
Messages
255
Hi,
I have the necessity to execute a macro for sorting a list of data on two columns.
More exactly, let's suppose to have this situation:

A 10/2/2008 FFFF GGGG HHH
B 01/3/2008 PPPP LLLLL NNNN
B 12/4/2008 XXXX JJJJJ PPPP
B 08/1/2008 HHHH SSSS IIIII
C 15/10/2008 AAA BBBB CCC

I need this sort:
A 10/2/2008 FFFF GGGG HHH
B 08/1/2008 HHHH SSSS IIIII
B 01/3/2008 PPPP LLLLL NNNN
B 12/4/2008 XXXX JJJJJ PPPP
C 15/10/2008 AAA BBBB CCC

Any suggestion will be well appreciated.

Thanks in advance for your kind support.

Regars,

Giovanni
 
Great stuff! Would this flavor be possible with a macro?

Sort on column A (ascending alphabetically)
Sort on column N (custom value - i.e. EXTRA-SMALL, SMALL, MEDIUM, LARGE, EXTRA-LARGE, 2X, 3X...)

Thanks!
 
Upvote 0

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Sure haven't. I'm quite a novice with VB and advanced Excel. :(

Unfortunately I don't even really know where to start!

Thanks.
 
Upvote 0
Yes, you can! I have & I was so happy to discover it! If you go to Tools>Options & go to the Custom Lists tab, you can create a list of whatever words/numbers you want to search for, in whatever order you want it to search.

Jenny
 
Upvote 0
OK, I found custom lists, and have one created, but don't know where to go from there. If I record a macro, how do I get it to sort column A ascending but then get it to do a secondary sort by the custom list?
 
Upvote 0
Edited to say - oops, just realized you want the SECONDARY sort by the custom list. I can't help you there, but am interested in the answer
Jenny
 
Upvote 0
Oh, of course; I knew that! It just escaped me for a bit! (If I was DOING it, I'd have remembered, but just talking about it isn't enough to jog my (poor worn-out) memory)
Sheesh, do I feel stupid NOW! :eek:

Jenny
 
Upvote 0

Forum statistics

Threads
1,216,082
Messages
6,128,700
Members
449,464
Latest member
againofsoul

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top