Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » microsoft excel course - Sort column data
microsoft excel course - Sort column data
Resolved · Low Priority · Version Standard
Sort column data
I want the excel vba statement to sort the data in a column.I have tried the statement: -
Range("A1").SortSpecial SortOrder = x1Ascending
But now its not working. I get the compile error. Cant find project or library?
Also i dont know which library files are need to be installed.
Please give me the alternate statement for this?
For upcoming training course dates see: Pricing & availability
RE: Sort column data
Hi Yogesh,Thank you for your question.
Range("A1").SortSpecial will sort on the cell A1 only.
1) If the range region is fixed, then type in the region:
e.g. Range("A1:D40").Sort
2) If the range region is flexible, then type in the selection:
e.g.
Selection.CurrentRegion.Select
Selection.Sort Key1:=Range("A1")
3) To sort data by first column in ascending order, I would use the following 2 lines:
Selection.CurrentRegion.Select
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, _
Header:=xlGuess, OrderCustom:=1
Hope this helps.
Regards,
Katie
|
|
» Forum post: Report |



Course updates

