+ Reply to Thread
Results 1 to 12 of 12

Re-ordering some columns (groups of columns)

  1. #1
    Registered User
    Join Date
    11-22-2008
    Location
    Spain
    Posts
    21

    Re-ordering some columns (groups of columns)

    Hey

    I must put in descendent order some columns, but the thing is a bit more complicated...
    As my english is not very good i am gonna explain it with a simple example:

    ----------------------------------
    1 4 2 5 rabit fox dog cat
    2 6 1 3 bird fis wolf mouse
    ----------------------------------------

    Ok, i must order the numbers in a ascendent way, but reordering one number means also reordering its correspondient name (the name of the animals at its right).
    So, again, with an example you will see it better:

    Ordering the first row it must appear like this:

    ----------------------------------------------
    1 2 4 5 rabit dog fox cat
    ----------------------------------------------

    I didnt know if i had to post it here or in other subforum and either if it can be done with excel.

    Can someone help me?
    Can it be done with excel?
    If not, how could i do it?

    Lots of thanks

    See you!

  2. #2
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Re-ordering some columns (groups of columns)

    pepito,

    Welcome to the Exceltip Board.

    Please attach your workbook - see "Manage Attachments".


    Have a great day,
    Stan
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  3. #3
    Registered User
    Join Date
    11-22-2008
    Location
    Spain
    Posts
    21
    Ok, i dont know if it hepls a lot, but well.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Re-ordering some columns (groups of columns)

    pepito,

    See the attached workbook.

    Your original sheet "Hoja1", range A1:K10.

    Is sheet "Hoja1", range A19:K28, sorted correctly ?


    Have a great day,
    Stan

  5. #5
    Registered User
    Join Date
    11-22-2008
    Location
    Spain
    Posts
    21
    Quote Originally Posted by stanleydgromjr View Post
    pepito,

    See the attached workbook.

    Your original sheet "Hoja1", range A1:K10.

    Is sheet "Hoja1", range A19:K28, sorted correctly ?


    Have a great day,
    Stan
    O yeah!!
    Impressive

    Lots of thanks man, how did you do it?

  6. #6
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Re-ordering some columns (groups of columns)

    pepito,

    how did you do it?

    Open the attached workbook, and run the "ReorderColumns" macro.


    Have a great day,
    Stan

  7. #7
    Registered User
    Join Date
    11-22-2008
    Location
    Spain
    Posts
    21

    Smile

    Quote Originally Posted by stanleydgromjr View Post
    pepito,

    Open the attached workbook, and run the "ReorderColumns" macro.

    Have a great day,
    Stan
    Thankyou again Stan, thousands of thanks

    Only a little stupid problem I made a little mistake when i posted. I wanted to say that values had to be ordered in descendet way, not ascendent.

    Sorry for the mistake. I hope it wont be too difficult to change it in that macro.

    Thank you.

  8. #8
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Re-ordering some columns (groups of columns)

    pepito,

    Here you go.


    Have a great day,
    Stan

  9. #9
    Registered User
    Join Date
    11-22-2008
    Location
    Spain
    Posts
    21
    Thanks again Stan

    Sorry, you are gonna kill me, but i forguet that i had to do it not only with 2 groups of columsn, but with 5.
    I hope i wont be too difficult

    You will find 5 groups of colums in the file:
    -c1, c2...c5
    -type c1, type c2...typec5
    -subtype c1, subtype c2...subtypec5
    -style c1, style c2...style c5.
    -orienta c1, orienta c2,...orientac5

    You did it with 1st and 2nd group of columns (c and type).
    But i have just remember that i must add some other columns and do the same with them.
    I mean, column c must be ordered as you did, and also type columns, but also must work in the same way subtype, style and orienta.

    I dont know if i have explained myselft good.
    All columsn are related with the 1st group (c1, c2...c5), so if c columns change its possition it must also change the other 4 groups.

    Sorry, i forguet to tell it in the post i think it would had been simple to implement it only one time...

    Thank you Stan, and lots of sorrys

    Attachment file for the example:
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    11-22-2008
    Location
    Spain
    Posts
    21
    Is it very difficult?

  11. #11
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Re-ordering some columns (groups of columns)

    pepito,

    Last try/update.

    See the attached workbook "Reordering some columns - groups of columns - pepito - demo(2).xls" with the new "ReorderColumns" macro.


    Have a great day,
    Stan

  12. #12
    Registered User
    Join Date
    11-22-2008
    Location
    Spain
    Posts
    21
    Well, thanks Stan, it was not exactly what i wanted, but as you said it would be your last try/update, i tryed it by myself.

    The problem is that i dont know how to program in Visual
    The macro runs good now, ordering also the rest of columns, but the problem is that i dont know why, i am not sure why it works.

    Can you tell me if its ok?

    I did a little change in the "With Range" line adding this: "& Ctr& + 2"
    I also wanted to add & Ctr& + 3 and & Ctr& + 4, but i works nice as its now and if i add them the macro gives an error.

    Please Login or Register  to view this content.

    I also do it adding that things and deletting some lines after the whith:
    Please Login or Register  to view this content.

    How is good?

    Thank you.
    Last edited by pepito; 11-30-2008 at 04:43 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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