0
Thanks

A few words of thanks would be greatly appreciated.

Macro to sort data with respect to the column




Issue


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.

Solution


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

Note


Thanks to rizvisa1 for this tip on the forum.
0
Thanks

A few words of thanks would be greatly appreciated.

Ask a question
CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jeff Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.

Published by . Latest update on by aakai1056.

This document, titled "Macro to sort data with respect to the column," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (https://ccm.net/).

0 Comments