+ Reply to Thread
Results 1 to 5 of 5

Excel 2007 Auto sorting rows by multiple columns that contain values that are calculated

  1. #1
    Registered User
    Join Date
    07-20-2010
    Location
    Leeds
    MS-Off Ver
    Excel 2003
    Posts
    5

    Excel 2007 Auto sorting rows by multiple columns that contain values that are calculated

    Hi all

    I'm trying to insert auto sort functionality into a spreadsheet at work and I am struggling a bit. I've found a few examples around here and on the web that are slightly like what I need, but not exactly.

    The data in my spreadsheet is confidential so I've had to come up with something similar and have used the Premier League table. I've created this in Excel 2013 but my work computers are running 2007.

    In theory what I would like to do is sort the data automatically as it is entered, First by column H (highest to lowest), then by F (highest to lowest) and then by G (lowest to highest).

    Column H can be updated by a change in column C or D.

    For example if I changed cell D20 to 6, H20 would become 33 and I would like the entire row 20 to switch with row 19.

    From looking around it looks to be a case of adding VBA code but I can't quite work out a solution.

    Any help, even pointing to a thread where this has been previously answered, would be greatly appreciated.

    Thanks
    Attached Files Attached Files
    Last edited by bobatron83; 05-27-2014 at 01:37 PM. Reason: Changing to solved

  2. #2
    Valued Forum Contributor
    Join Date
    09-01-2013
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    324

    Re: Excel 2007 Auto sorting rows by multiple columns tht contain values that are calculate

    Right click on the Sheet tab, click view code and paste this code in the VBA window that opens.

    Please Login or Register  to view this content.


    Shelton A.
    If Helpful, Add Reputaion!

  3. #3
    Registered User
    Join Date
    07-20-2010
    Location
    Leeds
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Excel 2007 Auto sorting rows by multiple columns tht contain values that are calculate

    Wow thanks! Yes that works. I should have probably mentioned in the original post that I would also like it to auto sort if the values in the F and G columns changed. For example if 2 rows had

    B C D E F G H
    38 27 5 6 102 50 86
    38 27 5 6 102 50 86

    and I changed either F3 to 104 or G3 to 49, it also auto sorts. But I didn't, so perfect response. Hopefully I will be able to work it out from the above code.

    Again Many Thanks!

  4. #4
    Valued Forum Contributor
    Join Date
    09-01-2013
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    324

    Re: Excel 2007 Auto sorting rows by multiple columns tht contain values that are calculate

    No problem at all. You can just extend the intersect range line like so:

    If Not Intersect(Target, Range("C2:D" & lr, "F2:G" & lr)) Is Nothing Then


    Code update:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    07-20-2010
    Location
    Leeds
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Excel 2007 Auto sorting rows by multiple columns tht contain values that are calculate

    YOU ARE A STAR!

    Seriously I can't thank you enough. That is brilliant.

+ 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. Excel 2007 : Align rows by matching values in other columns
    By jhanson60 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-14-2014, 11:27 PM
  2. [SOLVED] Excel 2007 : Need help sorting data from one column to multiple columns
    By actressinpink in forum Excel General
    Replies: 9
    Last Post: 09-13-2013, 09:01 AM
  3. [SOLVED] Remove duplicate rows by matching values across columns in Excel 2007
    By guest2013 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-15-2013, 12:00 AM
  4. Replies: 1
    Last Post: 09-01-2012, 04:57 AM
  5. Replies: 4
    Last Post: 05-19-2008, 05:13 PM

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