Automatically Reorder 77 Columns based on row 1 contents
Results 1 to 6 of 6

Thread: Automatically Reorder 77 Columns based on row 1 contents
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular
    Join Date
    Sep 2002
    Posts
    766
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Automatically Reorder 77 Columns based on row 1 contents

    We have a system with an excel export, but the columns are not in the order we need, nor are they even in the same order each time we perform this export.

    Is it possible to redefine the columns in Excel with some VBA? I would want this done based on the contents of A1 through CY1. These values are consistent and unique.

    If anyone can point me in the right direction, I would greatly appreciate it!
    Excel 2010

  2. #2
    Moderator mole999's Avatar
    Join Date
    Oct 2004
    Location
    UK
    Posts
    9,819
    Post Thanks / Like
    Mentioned
    16 Post(s)
    Tagged
    2 Thread(s)

    Default Re: Automatically Reorder 77 Columns based on row 1 contents

    first off i would look at macro recorder, record your actions you use to fix the file, then it could be refined for regular use
    • Yes I know there are better ways to do it. I just wish I knew them. - 97, 2003, 2007, 2010, 2013, 2016 & 2019
    • I wear my ignorance openly, excel is not my chosen career, its a means to an ends
    • Posting Guidelines Want to post well laid out questions and answers Translate Excel Versions
      Code:
      [CODE ]Put Your Code[/ CODE]
    • Settings > General Settings (on the left) scroll to the bottom, > Miscellaneous Options > Use ENHANCED
    • X-Posting Guidelines Rule 13 > CHART STUFF

  3. #3
    Board Regular
    Join Date
    Sep 2002
    Posts
    766
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Automatically Reorder 77 Columns based on row 1 contents

    Quote Originally Posted by mole999 View Post
    first off i would look at macro recorder, record your actions you use to fix the file, then it could be refined for regular use
    Since the columns are always in a different order when exported, I don't think I could use a macro recorder. I think I'd have to define the order of the columns in the VBA, based on the contents of row 1.
    Excel 2010

  4. #4
    Moderator mole999's Avatar
    Join Date
    Oct 2004
    Location
    UK
    Posts
    9,819
    Post Thanks / Like
    Mentioned
    16 Post(s)
    Tagged
    2 Thread(s)

    Default Re: Automatically Reorder 77 Columns based on row 1 contents

    do they have headers
    • Yes I know there are better ways to do it. I just wish I knew them. - 97, 2003, 2007, 2010, 2013, 2016 & 2019
    • I wear my ignorance openly, excel is not my chosen career, its a means to an ends
    • Posting Guidelines Want to post well laid out questions and answers Translate Excel Versions
      Code:
      [CODE ]Put Your Code[/ CODE]
    • Settings > General Settings (on the left) scroll to the bottom, > Miscellaneous Options > Use ENHANCED
    • X-Posting Guidelines Rule 13 > CHART STUFF

  5. #5
    Board Regular
    Join Date
    Sep 2002
    Posts
    766
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Automatically Reorder 77 Columns based on row 1 contents

    Yeah, row 1 is the headers, and all header values are unique.
    Excel 2010

  6. #6
    Moderator mole999's Avatar
    Join Date
    Oct 2004
    Location
    UK
    Posts
    9,819
    Post Thanks / Like
    Mentioned
    16 Post(s)
    Tagged
    2 Thread(s)

    Default Re: Automatically Reorder 77 Columns based on row 1 contents

    so potentially the header may be the key to getting it to sort
    • Yes I know there are better ways to do it. I just wish I knew them. - 97, 2003, 2007, 2010, 2013, 2016 & 2019
    • I wear my ignorance openly, excel is not my chosen career, its a means to an ends
    • Posting Guidelines Want to post well laid out questions and answers Translate Excel Versions
      Code:
      [CODE ]Put Your Code[/ CODE]
    • Settings > General Settings (on the left) scroll to the bottom, > Miscellaneous Options > Use ENHANCED
    • X-Posting Guidelines Rule 13 > CHART STUFF

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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