Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

Sorting in Excel

Thread Tools
 
Search this Thread
 
Old 08 November 2006, 01:17 PM
  #1  
SiGill
Scooby Newbie
Thread Starter
 
SiGill's Avatar
 
Join Date: Nov 2006
Posts: 6
Likes: 0
Received 0 Likes on 0 Posts
Default Sorting in Excel

I am putting together a league table in Excel for my local Pool League. I've added a formula so that when I enter each person's points Excel automatically tells me what position that person is in. How can I now put in a formula that automatically sorts the rows so that the the person in position 1 is automatically at the top and the person in position 10 is automatically at the bottom, etc
Old 08 November 2006, 01:52 PM
  #2  
ChefDude
Scooby Regular
 
ChefDude's Avatar
 
Join Date: Aug 2005
Posts: 4,290
Likes: 0
Received 0 Likes on 0 Posts
Default

A2:B6 is the grid area to sort
B6 is the column to sort on

stick it in the sheet code
Private Sub Worksheet_Change(ByVal Target As Range)
Range("A2:B6").Select
Range("B6").Activate
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("A2").Select
End Sub
Old 08 November 2006, 01:53 PM
  #3  
ChefDude
Scooby Regular
 
ChefDude's Avatar
 
Join Date: Aug 2005
Posts: 4,290
Likes: 0
Received 0 Likes on 0 Posts
Default

prolly should make the last line Target.Select

so the cursor stays on the cell you updated
Old 09 November 2006, 03:23 PM
  #4  
SiGill
Scooby Newbie
Thread Starter
 
SiGill's Avatar
 
Join Date: Nov 2006
Posts: 6
Likes: 0
Received 0 Likes on 0 Posts
Default

Thanks for the Reply Chef Dude. But could you put it in more of a dummy format. I'm totally lost.

Thanks

Simon
Old 09 November 2006, 04:22 PM
  #5  
ChefDude
Scooby Regular
 
ChefDude's Avatar
 
Join Date: Aug 2005
Posts: 4,290
Likes: 0
Received 0 Likes on 0 Posts
Default

ok, you need the top left cell (A2 for instance) to the bottom right cell (say, B6) of your rows you want to sort

if you press [ALT][F11] you get behind the scenes in Excel. Double click on (Sheet1) and paste in this code.

where it says A2, that should be the cell at the top left
B6 should be replaced with the bottom right cell

B2 should be the top cell in the column to be sorted on.
Old 09 November 2006, 04:54 PM
  #6  
SiGill
Scooby Newbie
Thread Starter
 
SiGill's Avatar
 
Join Date: Nov 2006
Posts: 6
Likes: 0
Received 0 Likes on 0 Posts
Default

Makes a bit more sense, I have done all that and pasted in everything, gone back to my spreadsheet but I get the following message when I put information into those cells. "Run-time error '1004': Aplication-defined or object-defined error" It then gives me the following options.
End Debug or Help
Old 10 November 2006, 07:49 AM
  #7  
SiGill
Scooby Newbie
Thread Starter
 
SiGill's Avatar
 
Join Date: Nov 2006
Posts: 6
Likes: 0
Received 0 Likes on 0 Posts
Default

It then highlights the below 3 lines

Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

Your help is really appreciated.

Simon
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
Mattybr5@MB Developments
Full Cars Breaking For Spares
28
28 December 2015 11:07 PM
Mattybr5@MB Developments
Full Cars Breaking For Spares
12
18 November 2015 07:03 AM
leg200
Subaru Parts
5
07 October 2015 07:31 AM
has-scooby
Subaru Parts
4
06 October 2015 03:47 PM
bluebullet29
General Technical
9
05 October 2015 02:17 PM



Quick Reply: Sorting in Excel



All times are GMT +1. The time now is 06:34 AM.