Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default 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 ***
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Arrange B values ascending order but keep attached to column A in. Zimba Excel Discussion (Misc queries) 1 February 21st 10 04:09 PM
how can i change the order(ascending, descending) in a column? Danny Excel Discussion (Misc queries) 4 April 23rd 07 04:54 AM
Sorting Data in ascending order sharon2006 Excel Discussion (Misc queries) 1 March 14th 06 01:07 AM
sorting number in ascending order Janice Lee via OfficeKB.com Excel Discussion (Misc queries) 2 April 8th 05 10:31 PM
Sorting into Surname order (alphabetically ascending) Mark Excel Programming 1 January 6th 04 01:03 PM


All times are GMT +1. The time now is 09:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"