+ Reply to Thread
Results 1 to 7 of 7

Reverse the order of a macro the rearranges columns

  1. #1
    Registered User
    Join Date
    02-12-2018
    Location
    Mpls, USA
    MS-Off Ver
    360 2016
    Posts
    11

    Reverse the order of a macro the rearranges columns

    I have a macro (I do not recall where I got this) that Rearranges the order of columns on a sheet which can have hundreds of columns by an array of header names

    So if the array of headers is
    Please Login or Register  to view this content.
    then my sheet would look like

    front.png

    But I often need to place the columns at the END of the sheet
    So if the array of headers is
    Please Login or Register  to view this content.
    then my sheet would look like
    reverse.png

    But I can not figure out how to alter the Sub and/or function to do this

    Thank you in advance for your help with this
    (I have a macro that does this with pasting and cutting but is extremely slow on sheets with lots of columns)

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: Reverse the order of a macro the rearranges columns

    Try this macro
    Please Login or Register  to view this content.
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Reverse the order of a macro the rearranges columns

    Einarr,
    Try
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    02-12-2018
    Location
    Mpls, USA
    MS-Off Ver
    360 2016
    Posts
    11

    Re: Reverse the order of a macro the rearranges columns

    Jindon, thank you for your help. The front ordering is working but the reverse is failing I added an example file
    Last edited by Einarr; 05-25-2021 at 09:57 AM.

  5. #5
    Registered User
    Join Date
    02-12-2018
    Location
    Mpls, USA
    MS-Off Ver
    360 2016
    Posts
    11

    Re: Reverse the order of a macro the rearranges columns

    Here is the file

    I am using the example of your macro on the data in the file

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Einarr; 05-25-2021 at 11:41 AM.

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Reverse the order of a macro the rearranges columns

    Can you change one line in "Function GetOrder"
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    02-12-2018
    Location
    Mpls, USA
    MS-Off Ver
    360 2016
    Posts
    11

    Re: Reverse the order of a macro the rearranges columns

    Jindon, that fixes the problem. Thank you!

    I like the idea of being able to choose to sort to the front of the sheet or the end of the sheet so I changed the function slightly for any one interested

    Please Login or Register  to view this content.

+ 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. Columns appear in reverse order
    By potterdj in forum Excel General
    Replies: 3
    Last Post: 03-10-2015, 05:43 PM
  2. [SOLVED] Macro to Reverse Order of Columns but Dependent on Number of Data Rows
    By francois28 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-10-2012, 06:34 PM
  3. Stacked Bar Chart columns are in reverse order
    By twfry in forum Excel General
    Replies: 6
    Last Post: 03-14-2011, 04:43 AM
  4. Help rookie here need macro reverse word order
    By MikeKasmeier in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-13-2009, 12:08 PM
  5. Reverse column order with a macro
    By misterhanky@gmail.com in forum Excel General
    Replies: 3
    Last Post: 06-01-2006, 05:45 PM
  6. How to reverse order of rows and columns
    By Johnny in forum Excel General
    Replies: 3
    Last Post: 09-11-2005, 11:05 AM
  7. [SOLVED] How 2 reverse order of columns
    By Bill Meacham in forum Excel General
    Replies: 3
    Last Post: 02-20-2005, 12:06 AM

Tags for this Thread

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