How do I sort a list automatically?

G

Guest

I have a range of indeterminate length consisting of 3 columns (name, team,
goals - it's a top-scorer list.)

What I want to do is have Excel automatically sort the full range based on
the Goals column whenever data is added to the list (ie new scorer entered)
or edited (ie existing scorer gets another goal.) to keep the list always in
order of most goals scored.

Anyone got any ideas?
 
P

Paul B

Defoes, try this
This assumes that your first row is a header row, and that you put data in
columns A & B and then in C, it will sort by column C when data is put, or
changed, in column C.
Right click on the worksheet tab and view code, paste in the window that
opens



Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Column = 3 Then

Range("A:C").Sort Key1:=Range("C2"), Order1:=xlDescending, _

Header:=xlYes, OrderCustom:=1, MatchCase:=False, _

Orientation:=xlTopToBottom

End If

End Sub
--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top