Macros to sort data with respect to the colum

Solved/Closed
Test - 5 Feb 2010 à 00:39
rizvisa1 Posts 4478 Registration date Thursday 28 January 2010 Status Contributor Last seen 5 May 2022 - 5 Feb 2010 à 04:50
Hello,

I am facing a problem in sorting the data w.r.t to column header. I have 25 columns in which i need to sort the sata w.r.t to two of the columns. When i tried this with macros i found that the data is sorted along with column header as well and i am struck here without any clue.

Could any one of you help me out to overcome this issue.

Thanks in Advance.

1 response

rizvisa1 Posts 4478 Registration date Thursday 28 January 2010 Status Contributor Last seen 5 May 2022 766
5 Feb 2010 à 04:50
you need to start from sort from row 2 and tell that there is a header

Selection.Sort _
Key1:=Range("A2"), Order1:=xlAscending, _
Header:=xlYes, OrderCustom:=1, _
MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal