Sorting a Column in ascending order in excel vba

Y

yogeshyl

I need a code to sort a column in a excel file in ascending order. I had used
the below code
Range("A1").SortSpecial SortOrder:=xlAscending

but its giving error. Kindly guide me on this.

Yogesh
 
L

Les Stout

Hi yogeshyl, the code below will just sort the column only.

Columns("A:A").Sort Key1:=Range("A1"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortTextAsNumbers




Best regards,

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top