+ Reply to Thread
Results 1 to 6 of 6

Sort the order of columns based on values of header?

  1. #1
    Registered User
    Join Date
    10-01-2008
    Location
    Park City
    Posts
    59

    Sort the order of columns based on values of header?

    I'm familiar with the typical sort functions where you sort the order of the rows based on the values.
    However I am having real trouble changing the order of columns based on the value of headers.

    Can anybody point me in the right direction?

    Thanks

    GG
    Last edited by Granite-Granny; 07-14-2014 at 04:13 PM. Reason: typo

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Sort the order of columns based on values of header?

    When sorting, click on options and choose left to right.
    Martin

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: Sort the order of columns based on values of header?

    Click on Sort icon | Custom Sort | Options | Left to Right | Row 1


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Registered User
    Join Date
    10-01-2008
    Location
    Park City
    Posts
    59

    Re: Sort the order of columns based on values of header?

    Ah ha. Thanks.

    I ended up with this code after figuring out the correct syntax with record macro:

    Please Login or Register  to view this content.
    Thanks

    GG
    Last edited by Granite-Granny; 07-14-2014 at 04:59 PM. Reason: typo

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: Sort the order of columns based on values of header?

    You're welcome. Thanks for the rep.

  6. #6
    Registered User
    Join Date
    10-01-2008
    Location
    Park City
    Posts
    59

    Re: Sort the order of columns based on values of header?

    No problem man. The other thing I just found out is that excel goes a bit crazy if you have two sorts, one top to bottom followed by one left to right.
    In the first sort command I didn't specify orientation:=xltoptobottom assuming it would be the default. Every second time I ran
    the macro the sort would get all jacked up. It took me about half an hour to figure out that if you don't specify the orientation
    it defaults to what was last done i.e. lefttoright!

    Silly computer program!

    GG

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Export specific columns in different order without header to csv
    By w2kbug in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-24-2014, 04:42 AM
  2. [SOLVED] Rearrange(sort) Columns based on number in Column header string.
    By hifliers in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-04-2014, 01:36 AM
  3. Sort pivot tables based on values columns
    By Big_Kev in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-22-2013, 11:10 AM
  4. How to select two columns of values and sort them into ascending order,but w/o moving them
    By jonathancook in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-10-2013, 05:51 PM
  5. [SOLVED] Sort multiple columns based on column header
    By Langer101 in forum Excel Programming / VBA / Macros
    Replies: 39
    Last Post: 01-09-2013, 09:55 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1