Hi All

I'm trying to code a worksheet so that when I press a button, it sorts
the column in numerical order. I have been using the code

Private Sub commandbutton12_click()
Range("A71:U1000").Select
    Selection.Sort Key1:=Range("A71"), Order1:=xlAscending,
Header:=xlNo, _
        OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Range("A2").Select
Call CommandButton1_Click
End Sub

However, whether the cells are formatted as numbers, general or text,
the numbers sort in the following manner

1
10
2
20 etc

rather than

1
2
10
20etc

How can I sort them as per the second manner please?

Many thanks in advance

--~--~---------~--~----~------------~-------~--~----~
Visit the blog to download Excel tutorials at 
http://www.excel-macros.blogspot.com

To post to this group, send email to excel-macros@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/excel-macros?hl=en

Visit & Join Our Orkut Community at 
http://www.orkut.com/Community.aspx?cmm=22913620

Visit the blog to download Excel tutorials at 
http://www.excel-macros.blogspot.com

To Learn VBA Macros Please visit http://www.vbamacros.blogspot.com

To see the Daily Excel Tips, Go to:
http://exceldailytip.blogspot.com
-~----------~----~----~----~------~----~------~--~---

Reply via email to