Results 1 to 2 of 2

Auto Sort Data

Threaded View

  1. #1
    Registered User
    Join Date
    07-17-2013
    Location
    HOWN
    MS-Off Ver
    Excel 2010
    Posts
    5

    Talking Auto Sort Data

    Still learning VBA so please bare with me..

    Trying to Create a sheet that will sort students grades based on rank and name.

    Breif example of what im trying to do:

    Student Test 1 Test 2 AVG Rank
    Bob 81 89 85 2
    Sue 91 95 95 1
    Joe 79 71 75 3

    I would like the sheet to sort based on rank and name in descending order while keeping the whole row for each student in tact. So in this case Sue would move up to the top with all her test scores and average. I would like to use a button to do this as well.

    Here is the code I have been trying
    Private Sub Worksheet_Change(ByVal Target As Range)
       If Target.Column = 2 Then
          Range("A1:E3").Sort _
           Key1:=Range("E1"), Order1:=xlAscending, _
             Key2:=Range("A1"), Order2:=xlAscending, _
             Header:=xlGuess, OrderCustom:=1, MatchCase:=False, _
             Orientation:=xlTopToBottom
         End If
       
    End Sub
    No changes are made to the sheet after running this Macro

    Thank you so much for your help!
    Grades Order.xlsm
    Last edited by Leith Ross; 07-14-2015 at 02:17 PM. Reason: Add Attachment

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Auto Sort Data
    By Redfeather in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-04-2013, 12:56 PM
  2. Auto Sort data
    By Redfeather in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 12-04-2013, 09:29 AM
  3. Replies: 3
    Last Post: 10-08-2013, 02:59 PM
  4. Need help- Auto Sort data and auto subtotal
    By lesliewheeler in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-28-2013, 07:11 AM
  5. [SOLVED] Help with auto sort data
    By glamint in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-15-2012, 01:26 AM
  6. Auto Sort of Data
    By gavster in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-03-2009, 07:00 AM
  7. auto data sort ?
    By Avenger556 in forum Excel General
    Replies: 2
    Last Post: 09-27-2008, 09:32 PM
  8. Sort Data only/auto add row
    By su_jumptd in forum Excel General
    Replies: 3
    Last Post: 03-14-2008, 12:16 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