+ Reply to Thread
Results 1 to 11 of 11

Reorder columns from shortest to longest

  1. #1
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,774

    Reorder columns from shortest to longest

    Hello everybody
    I have in the attachment some columns which are different in height
    I want to reorder the columns by code and get the results in another sheet
    The desired results are illustrated in Sheet2
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-15-2009
    Location
    Homeless. I am not kidding.
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,134

    Re: Reorder columns from shortest to longest

    Not sure if you need VBA for it. But you can insert a help row to count the total records, then go to Sort > Option > Sort by Rows
    Attached Files Attached Files

  3. #3
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,774

    Re: Reorder columns from shortest to longest

    Thank you very much Mr. JieJenn

    I know that way ..But I need to do it by VBA

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013
    Posts
    16,864

    Re: Reorder columns from shortest to longest

    Try this
    Please Login or Register  to view this content.

  5. #5
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,774

    Re: Reorder columns from shortest to longest

    Mr. jindon .. Really wonderful
    I can't express ny happiness with this awesome code.
    Just a little point
    I don't know how to get my results in sheet2

  6. #6
    Forum Guru
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,702

    Re: Reorder columns from shortest to longest

    Hi,

    An alternative :

    Please Login or Register  to view this content.
    Regards

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013
    Posts
    16,864

    Re: Reorder columns from shortest to longest

    Change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  8. #8
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,774

    Re: Reorder columns from shortest to longest

    Thanks a lot Mr. Jindon for this great help
    Mr. karedog I tested your code but got 1004 error at this line
    Please Login or Register  to view this content.

  9. #9
    Forum Guru
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,702

    Re: Reorder columns from shortest to longest

    Sorry, previous code is for the range start on row 2 downward.

    Here is the new code :
    Please Login or Register  to view this content.
    Regards

  10. #10
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,774

    Re: Reorder columns from shortest to longest

    Thank you very much for all of you everybody

  11. #11
    Forum Guru
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,702

    Re: Reorder columns from shortest to longest

    You are welcome, glad I can help.

    Regards

+ 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. Help - VBA to automatically reorder columns
    By jsabo in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-11-2013, 05:08 PM
  2. Replies: 4
    Last Post: 04-05-2011, 01:09 PM
  3. Replies: 3
    Last Post: 06-16-2010, 04:23 PM
  4. shortest between 2 numbers
    By Martindelica in forum Excel General
    Replies: 4
    Last Post: 11-16-2007, 09:32 PM
  5. Longest Entry in Columns
    By Rebecca in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 02-26-2005, 12:07 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