ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sort Columns (https://www.excelbanter.com/excel-programming/368376-sort-columns.html)

T De Villiers[_59_]

Sort Columns
 

Hi,

I have 5 columns with 5000 rows.
Column Headings a
C1, C2, Account, Amount, Type

I need to write a macro which will sort data by Column to:
Account, Type, Amount, C1, C2

Many Thank

--
T De Villier
-----------------------------------------------------------------------
T De Villiers's Profile: http://www.excelforum.com/member.php...fo&userid=2647
View this thread: http://www.excelforum.com/showthread.php?threadid=56506


Excelenator[_5_]

Sort Columns
 

This is MUCH easier than you might think and doesn't require a macro if
you can believe that!!

First you need to set up a custom list of the column names in the order
you want them to appear sorted in. To do this go to
Tools\Options\Custom Lists. Once you are there enter the column names
in the "List entries" box in the correct sort order separated by a
comma and then click the "Add" button to the right and then the "OK"
button.

Second highlight the columns you want to sort and select Data\Sort when
the Sort dialog box opens select "Options" at the bottom of the dialog
box. In the Sort Options dialog box that opens select the custom list
you just created from the drop down box "First key sort order". Then
click the radio button "Sort left to right" and click "OK".

Now make sure that the "Sort by" drop down box on the "Sort" dialog
says "Row 1" and the "Ascending" radio button next to it is selected.
Click "OK" and your columns are sorted in the order you want them.






T De Villiers Wrote:
Hi,

I have 5 columns with 5000 rows.
Column Headings a
C1, C2, Account, Amount, Type

I need to write a macro which will sort data by Column to:
Account, Type, Amount, C1, C2

Many Thanks



--
Excelenator


------------------------------------------------------------------------
Excelenator's Profile: http://www.excelforum.com/member.php...o&userid=36768
View this thread: http://www.excelforum.com/showthread...hreadid=565069



All times are GMT +1. The time now is 06:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com