Hi Paul, Thanks for your reply. could you try my clue. That is find the column number and assign value to it.
Thanks, Sundarvelan On Fri, Apr 30, 2010 at 5:01 PM, Paul Schreiner <schreiner_p...@att.net>wrote: > Evidently, you're using Excel 2003, so the VBA sort command would look > different than mine in Excel2007. > > I recommend that you record a macro, > sort the sheet, then look at the code created. > > In Excel2007, it looks like: > > Sub SortData() > Cells.Select > ActiveWorkbook.Worksheets("Sample").Sort.SortFields.Clear > ActiveWorkbook.Worksheets("Sample").Sort.SortFields.Add _ > Key:=Range("A2:A1929"), _ > SortOn:=xlSortOnValues, _ > Order:=xlAscending, _ > DataOption:=xlSortNormal > ActiveWorkbook.Worksheets("Sample").Sort.SortFields.Add _ > Key:=Range("L2:L1929"), _ > SortOn:=xlSortOnValues, _ > Order:=xlAscending, _ > DataOption:=xlSortNormal > With ActiveWorkbook.Worksheets("Sample").Sort > .SetRange Range("A1:N1929") > .Header = xlYes > .MatchCase = False > .Orientation = xlTopToBottom > .SortMethod = xlPinYin > .Apply > End With > Range("A1").Select > End Sub > hth > > Paul > ------------------------------ > *From:* Sundarvelan N <nsund...@gmail.com> > *To:* excel-macros@googlegroups.com > *Cc:* swapnilp1...@gmail.com; osav...@gmail.com; villager.g...@gmail.com; > schreiner_p...@att.net > *Sent:* Fri, April 30, 2010 4:47:22 AM > *Subject:* $$Excel-Macros$$ Fwd: Excel Macro : Sorting Based on Column > Header > > Hello Friends, > > Please help me. Looking for your replies > > Thanks, > Sundarvelan > > ---------- Forwarded message ---------- > From: Sundarvelan N <nsund...@gmail.com> > Date: Fri, Apr 30, 2010 at 10:55 AM > Subject: Excel Macro : Sorting Based on Column Header > To: excel-macros@googlegroups.com > > > Hi Friends, > > Does any one know vba coding sorting based on column header row. I have > attached the sample excel file in which i need to sort client and Account > column. > > Thanks, > N.Sundarvelan > > > > -- > N.Sundarvelan > > -- > > ---------------------------------------------------------------------------------- > Some important links for excel users: > 1. Follow us on TWITTER for tips tricks and links : > http://twitter.com/exceldailytip > 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 > 3. Excel tutorials at http://www.excel-macros.blogspot.com > 4. Learn VBA Macros at http://www.quickvba.blogspot.com > 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com > > To post to this group, send email to excel-macros@googlegroups.com > > <><><><><><><><><><><><><><><><><><><><><><> > HELP US GROW !! > > We reach over 6,800 subscribers worldwide and receive many nice notes about > the learning and support from the group.Let friends and co-workers know they > can subscribe to group at > http://groups.google.com/group/excel-macros/subscribe > > -- > > ---------------------------------------------------------------------------------- > Some important links for excel users: > 1. Follow us on TWITTER for tips tricks and links : > http://twitter.com/exceldailytip > 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 > 3. Excel tutorials at http://www.excel-macros.blogspot.com > 4. Learn VBA Macros at http://www.quickvba.blogspot.com > 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com > > To post to this group, send email to excel-macros@googlegroups.com > > <><><><><><><><><><><><><><><><><><><><><><> > HELP US GROW !! > > We reach over 6,800 subscribers worldwide and receive many nice notes about > the learning and support from the group.Let friends and co-workers know they > can subscribe to group at > http://groups.google.com/group/excel-macros/subscribe > -- N.Sundarvelan -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> HELP US GROW !! We reach over 6,800 subscribers worldwide and receive many nice notes about the learning and support from the group.Let friends and co-workers know they can subscribe to group at http://groups.google.com/group/excel-macros/subscribe