This example sorts the range A1:C20 on Sheet1, using cell A1 as the first
sort key and cell B1 as the second sort key. The sort is done in ascending
order by row, and there are no headers. This example assumes there is data
in the range A1:C20.

Sub SortRange1()   Worksheets("Sheet1").Range("A1:C20").*Sort* _
        Key1:=Worksheets("Sheet1").Range("A1"), _
        Key2:=Worksheets("Sheet1").Range("B1")End Sub
                
This example sorts the region that contains cell A1 (the active region) on
Sheet1, sorting by the data in the first column and automatically using a
header row if one exists. This example assumes there is data in the active
region, which includes cell A1. The *Sort* method determines the active
region automatically.

Sub SortRange2()   Worksheets("Sheet1").Range("A1").*Sort* _
        Key1:=Worksheets("Sheet1").Columns("A"), _
        Header:=xlGuessEnd Sub


Hope the above 2 examples help.


On 4/20/09, Mike <mofla...@justice.gc.ca> wrote:
>
>
> Hi,
>
> Running a pool, and trying to create a macro to sort the results
> automatically.  Have a colunm with names and beside a colunm with
> point totals (sum of three fields).  Created a button that will sort
> the results in order, based on points from highest to lowest.
>
> any ideas??
>
> Thanks
>
> m
>
> >
>


-- 
http://funwithexcel.blogspot.com/

--~--~---------~--~----~------------~-------~--~----~
-------------------------------------------------------------------------------------
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com
-------------------------------------------------------------------------------------
-~----------~----~----~----~------~----~------~--~---

Reply via email to