ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sorting a Column in ascending order in excel vba (https://www.excelbanter.com/excel-programming/402554-sorting-column-ascending-order-excel-vba.html)

yogeshyl

Sorting a Column in ascending order in excel vba
 
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

OssieMac

Sorting a Column in ascending order in excel vba
 
Hi,

Why not try recording the code? Great method for getting the syntax.

--
Regards,

OssieMac


"yogeshyl" wrote:

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


Les Stout[_2_]

Sorting a Column in ascending order in excel vba
 
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 ***


All times are GMT +1. The time now is 02:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com