LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 857
Default Sort automatically

Hi,

but what criteria are changing? The code works on you original sample but
you aren't telling us enough.

--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire


"MAX" wrote:

Hello,

I created a table with a range of "A1:I6".

In row 1 starting from A1 I have these titles:
Team Play Win Draw Lose GF GA GD Points

In column A starting from A2 I have These names:
Roma
Milan
Lazio
Bari
Siena

The table is updated from such fixtures in the same sheet and all I want is
that when I post the results in these fixtures the table sort automatically
with these criterias.
1. The more points( Column I)
then 2. The more GD (Column H)
then 3. The more GF (Column F)

I want to sort this range "A2:I6".
I also attached the code (below), but when I post a result and
these criterias change, a window is coming up with Compile error and
Syntax error. Why?

This is the code that I am using:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim isect As Range
Set isect = Application.Intersect(Target, Range("F2:I6"))
If Not isect Is Nothing Then
With ActiveSheet
With .Sort.SortFields
.Clear
.Add Key:=Range("I2"), _
SortOn:=xlSortOnValues, Order:=xlDescending,
DataOption:=xlSortNormal
.Add Key:=Range("H2"), _
SortOn:=xlSortOnValues, Order:=xlDescending,
DataOption:=xlSortNormal
.Add Key:=Range("F2"), _
SortOn:=xlSortOnValues, Order:=xlDescending,
DataOption:=xlSortNormal
End With
With .Sort
.SetRange Range("A1:I6")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End With
End If
End Sub


Thanks.


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sort a column automatically Longtime Excel Worksheet Functions 12 March 26th 08 01:30 PM
How can I sort data automatically? surekha New Users to Excel 4 April 9th 07 05:16 PM
Automatically Sort Tables tamato43 Excel Discussion (Misc queries) 2 March 22nd 05 07:59 PM
How do I sort a list automatically? Defoes Right Boot Excel Discussion (Misc queries) 1 February 4th 05 05:56 PM
sort automatically Mike Lemke Excel Worksheet Functions 2 October 31st 04 08:18 PM


All times are GMT +1. The time now is 07:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"