PDA

View Full Version : Sort



tqm1
06-06-2007, 07:06 PM
Reference: http://www.excelforum.com/showthread.php?t=602533

Dear Experts

I want to sort following data on NAME in Ascending order

Name---- Code -----Path
Eric ------- 35 ------- A
John ------ 22 ------- B
Putan ----- 18 ------- D
Tony ------ 39 ------- C

With VBA Codes I want to sort sheet which has only three columns as mentioned.

Please help

lucas
06-06-2007, 08:31 PM
I got this using the macro recorder but it works:
Sub Macro1()
Cells.Select
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("E18").Select
End Sub

mdmackillop
06-07-2007, 09:26 AM
If you're using Excel 2000 or earlier, delete this from Steve's code
", _ DataOption1:=xlSortNormal "

Bob Phillips
06-07-2007, 10:13 AM
In fact delete it anyway, it is the default, so makes no difference in 2003 anyway (here).