+ Reply to Thread
Results 1 to 5 of 5

Vba to sort multiple columns as one list

  1. #1
    Registered User
    Join Date
    10-02-2012
    Location
    Ogden, Utah USA
    MS-Off Ver
    Excel 2007
    Posts
    2

    Vba to sort multiple columns as one list

    Hello, I have searched everywhere, so it seems, and can't find the solution anywhere. I have created a list of movies that I own in an excel sheet (2007) and have it go down 50 rows in Column A before I continued the list in Columns B, C and D for now. I am trying to find a way to make the entire list sort instead of just the columns. I like to be able to see all of the titles on the page without scrolling down. When I add a new movie I would like to be able to add it to the end of the list and then sort it and have it go where it belongs no matter which column that may be. I am hoping this is possible. To make it even better, it would be ideal to have it automatically sort when I add a new title.
    Attached Files Attached Files
    Last edited by FrostByte4; 10-03-2012 at 11:56 PM.

  2. #2
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: Vba to sort multiple columns as one list

    This may be a rather long way round, but it seems to work

    at the moment it is sorting the entire used range and copying the lis talpabetically starting at column CopyCol (column 8) and row copyrow (row 1). You may want to tweak these variables once you have tested it.

    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Vba to sort multiple columns as one list

    I propose NickyC's code with some changes, working on cells instead of arrays, I assumed the films list is not too long.

    Please Login or Register  to view this content.
    Last edited by patel45; 10-03-2012 at 02:10 AM.
    If solved remember to mark Thread as solved

  4. #4
    Registered User
    Join Date
    10-02-2012
    Location
    Ogden, Utah USA
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Vba to sort multiple columns as one list

    I appreciate your help, but I am apparently very ignorant in excel. I thought I knew it pretty well, but apparently I have a lot to learn. I included my movie list in excel format so it can be tested. Can somebody please try to test it on the document. Thank you very much for your help.

  5. #5
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: Vba to sort multiple columns as one list

    Hi
    I have tested both macros and they seem to work.
    do you know how to copy and run a macro? here's how:
    • press alt+F11 to open the VBA area
    • select insert > module
    • copy the code from this website and paste it into the VBA module you just inserted
    • Return to the spreadheet. On the developer tab, select macros and click the name of the macro you want to run

    if you cannot see the developer tab:
    • Click the File tab
      Click Options
      Click Customize Ribbon
      Under Customize the Ribbon and under Main Tabs, select the Developer check box
    Last edited by NickyC; 10-04-2012 at 12:35 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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