Results 1 to 6 of 6

Help needed with an auto sort macro!

Threaded View

Colin Strowbridge Help needed with an auto sort... 07-25-2012, 09:40 AM
GaidenFocus Re: Help needed with an auto... 07-25-2012, 09:52 AM
Colin Strowbridge Re: Help needed with an auto... 07-25-2012, 10:32 AM
GaidenFocus Re: Help needed with an auto... 07-25-2012, 10:53 AM
Cutter Re: Help needed with an auto... 07-25-2012, 08:47 PM
Colin Strowbridge Re: Help needed with an auto... 07-26-2012, 03:31 AM
  1. #1
    Registered User
    Join Date
    07-25-2012
    Location
    Liverpool, England
    MS-Off Ver
    Excel 2010
    Posts
    3

    Help needed with an auto sort macro!

    Hi

    I need some help please. Although I have used excel for years, I have never actually used it in-depth so am a novice sorry.

    I have put together a spreadsheet containing all the results of my teams bowling results for this season which I have finally got working correctly. The results then feed into another sheet to produce a league table.

    My problem is that I have tried to make a macro to autosort the table whenever something is changed in the resluts sheet. The macro works great if I use the shortcut key I put in but it doesnt do it automatically which is what I want but dont know how to do.

    My macro is


    Private Sub Worksheet_Change(ByVal Target As Range)
    
    Macro8()
    '
    ' Macro8 Macro
    '
    
    '
        Range("A5:Y28").Select
        ActiveWorkbook.Worksheets("Averages").Sort.SortFields.Clear
        ActiveWorkbook.Worksheets("Averages").Sort.SortFields.Add Key:=Range("E5:E28" _
            ), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
        ActiveWorkbook.Worksheets("Averages").Sort.SortFields.Add Key:=Range("I5:I28" _
            ), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
        With ActiveWorkbook.Worksheets("Averages").Sort
            .SetRange Range("A5:Y28")
            .Header = xlGuess
            .MatchCase = False
            .Orientation = xlTopToBottom
            .SortMethod = xlPinYin
            .Apply
        End With
    End Sub

    Can anybody help me please??

    I have attached my spreadsheet also
    Attached Files Attached Files
    Last edited by Cutter; 07-25-2012 at 08:46 PM. Reason: Added code tags

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