Sorting a Column in ascending order in excel vba

  • Thread starter Thread starter yogeshyl
  • Start date Start date
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
 
Hi,

Why not try recording the code? Great method for getting the syntax.
 
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
 

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

Back
Top