Welcome to Tech Support Forum home to more then 136,000 problems solved. Issues have included: Spyware, Malware, Virus Issues, Windows, Microsoft, Linux, Networking, Security, Hardware, and Gaming Getting your problem solved is as easy as:
1. Registering for a free account
2. Asking your question
3. Receiving an answer

Registered members:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* See fewer ads.
* And much more..

 



Want to know how to post a question? click here Having problems with spyware and pop-ups? First Steps
Go Back   Tech Support Forum > Microsoft Support > Microsoft Office support
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read


Microsoft Office support MS Office support forum

Reply
 
LinkBack Thread Tools
Old 05-22-2008, 06:26 PM   #1 (permalink)
Registered User
 
Join Date: May 2008
Posts: 4
OS: XP


Can someone help me Auto Sort in Excel?

Hi everyone,

I was wondering if someone can help me autosort a list of data.

What I have is the schedule for the upcoming European Cup of Football.

so I would like to have the standings auto sorted when people enter their predictions on the sheet...

Worksheet 1 has the predictions and on the right it has a blank table for the teams to go there... (Where I want the sorted data to go)

Worksheet 2 is just a bunch of formulas

worksheet 3 has the standings but not sorted in the table...

I would like it sorted by points first, and if their is a tie then sorted by GD (goal differential)

any help would be great :)

Thank a lot guys
Attached Files
File Type: rar European Cup 2008 ver 1.1.rar (11.1 KB, 44 views)
progpeps is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Important Information
Join the #1 Tech Support Forum Today - It's Totally Free!

TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free.

Join TechSupportforum.com Today - Click Here

Old 05-22-2008, 08:45 PM   #2 (permalink)
Registered User
 
Join Date: May 2008
Location: Baltimore, Maryland
Posts: 160
OS: Windows XP SP3


Re: Can someone help me Auto Sort in Excel?

Here are some tips that may help you get started. If, for example, you wanted to sort the "Group A" table on the third worksheet in your Excel file, you would select that worksheet, then select the appropriate range (E3:M7 in this example), go to the Excel menu and select Data and then Sort, select the Header row option, sort by Pts descending (or ascending), then by GD descending (or ascending).

If you wanted to perform that same operation using a macro, here's some sample code:
Code:
Sub DoSort()
    Dim ws As Worksheet
    Set ws = Worksheets(3)
    ws.Range("E3:M7").Sort Key1:=ws.Range("M3"), Order1:=xlDescending, _
        Key2:=ws.Range("L3"), Order2:=xlDescending, Header:=xlYes
End Sub
Modify as necessary.
David M58 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-22-2008, 09:53 PM   #3 (permalink)
Registered User
 
Join Date: May 2008
Posts: 4
OS: XP


Re: Can someone help me Auto Sort in Excel?

thank you...

is there any way to get it to update without hitting the pay button on the macro?

unless i'm doing something wrong here...

like how do I get it to autmatically sort without running the macro again?

Last edited by progpeps; 05-22-2008 at 10:19 PM.
progpeps is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-23-2008, 12:34 AM   #4 (permalink)
Registered User
 
Join Date: May 2008
Location: Baltimore, Maryland
Posts: 160
OS: Windows XP SP3


Re: Can someone help me Auto Sort in Excel?

Excel gives you several ways to automatically perform tasks. You could, for example, set it up to do that sorting subroutine every time someone enters data on the first worksheet. Or you can have it automatically perform the sorting right before the workbook is saved. Or you can have it do the sorting when the workbook is first opened. And, of course, you can have the sorting done when someone clicks on a command button, or when someone presses a keystroke combination, such as Ctrl-e.

First, you should decide how you want to handle the sorting. Do you want it to sort when someone types in a number? Or when someone saves the workbook? You have a number of choices.
David M58 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-23-2008, 06:58 AM   #5 (permalink)
Registered User
 
Join Date: May 2008
Posts: 4
OS: XP


Re: Can someone help me Auto Sort in Excel?

I would like it to sort when you enter a number in any of the cells E9:F32

say you enter

E F
1(it sorts) 5(it sorts)

Thanks
progpeps is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-23-2008, 09:46 AM   #6 (permalink)
Registered User
 
Join Date: May 2008
Location: Baltimore, Maryland
Posts: 160
OS: Windows XP SP3


Re: Can someone help me Auto Sort in Excel?

Here's one way to set it up. In Excel, press Alt-F11 to get to the Visual Basic Editor, then Ctrl-R to display the Project Explorer. In the Project Explorer, double-click the object Sheet1 (EC Fixtures) to open the code window. Put in the following code.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not (Application.Intersect(Worksheets(1).Range("E9:F32"), Target) Is Nothing) Then
        DoSort
    End If
End Sub

Private Sub DoSort()
    Worksheets(3).Range("E3:M7").Sort Key1:=Worksheets(3).Range("M3"), Order1:=xlDescending, _
        Key2:=Worksheets(3).Range("L3"), Order2:=xlDescending, Header:=xlYes
    Worksheets(3).Range("E10:M14").Sort Key1:=Worksheets(3).Range("M10"), Order1:=xlDescending, _
        Key2:=Worksheets(3).Range("L10"), Order2:=xlDescending, Header:=xlYes
    Worksheets(3).Range("E17:M21").Sort Key1:=Worksheets(3).Range("M17"), Order1:=xlDescending, _
        Key2:=Worksheets(3).Range("L17"), Order2:=xlDescending, Header:=xlYes
    Worksheets(3).Range("E24:M28").Sort Key1:=Worksheets(3).Range("M24"), Order1:=xlDescending, _
        Key2:=Worksheets(3).Range("L24"), Order2:=xlDescending, Header:=xlYes
End Sub
Now, whenever you make a new entry in any cell in the range E9:F32 on the first worksheet, it will perform that sorting subroutine on the third worksheet. Modify as necessary.

Last edited by David M58; 05-23-2008 at 09:52 AM.
David M58 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-23-2008, 10:13 AM   #7 (permalink)
Registered User
 
Join Date: May 2008
Posts: 4
OS: XP


Re: Can someone help me Auto Sort in Excel?

thank you so much Dave...

I was trying that other function as well but I was missing the If Not, so it wasn't calling to DoSort function


Thank for you help d00d

:)!!!!!!
progpeps is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-23-2008, 10:41 AM   #8 (permalink)
Registered User
 
Join Date: May 2008
Location: Baltimore, Maryland
Posts: 160
OS: Windows XP SP3


Re: Can someone help me Auto Sort in Excel?

Glad to help!
David M58 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 08-29-2009, 07:44 AM   #9 (permalink)
Registered User
 
Join Date: Aug 2009
Posts: 1
OS: Vista


Re: Can someone help me Auto Sort in Excel?

Great! This thread was of huge help Mine works too!

Thank you big time!

PS: Hmm... Now I have to do all those matches and groups
Attached Files
File Type: rar Europa League.rar (15.1 KB, 7 views)

Last edited by KirKanu; 08-29-2009 at 08:07 AM.
KirKanu is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 09-10-2009, 11:36 AM   #10 (permalink)
Registered User
 
Join Date: Sep 2009
Posts: 1
OS: xp


Re: Can someone help me Auto Sort in Excel?

I tried the code above but got this error: "Run-time error '1004: Application-defined or object-defined error". Any suggestions? Here is the code that worked for me in excel 2003, it will not work either:
Private Sub Worksheet_Calculate()
Range("A1:C141").Sort _
Key1:=Range("B2"), _
Order1:=xlAscending, _
Key2:=Range("A2"), _
Order2:=xlAscending, _
Header:=xlGuess, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal, _
DataOption2:=xlSortNormal
End Sub
sschreib is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -7. The time now is 02:04 AM.



Copyright 2001 - 2009, Tech Support Forum
Home Tips Plus | Outdoor Basecamp | Automotive Support Forum

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85