ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Auto Sort Formulas (https://www.excelbanter.com/excel-programming/288937-auto-sort-formulas.html)

leandrocg

Auto Sort Formulas
 
hi i have seen and tried the auto sort posts here but none seem to work
in mine

then i tried in a new sheet and found that those worked only in
numbers, when i try sorting a formula it doesnt work

i have a table like this:

Name Games Points
Team1 2 9
Team2 2 4
Team3 2 1

and so on; as the points are formulas, related to the game results wich
there are also in the same sheet

is there a way to auto sort those point columns among with the team
name column? the columns are N8 up to V16


---
Message posted from http://www.ExcelForum.com/


Peter Atherton[_17_]

Auto Sort Formulas
 
leandrocg

you need to copy values. The sub Below copies from range
G1 to I8 to A1:c8 and sorts the results

You can adjust this better yourself

Sub SortLeague()
Range("A1").Select
Range("A1:C8").Value = Range("G1:I8").Value
Selection.Sort Key1:=Range("C2"), Order1:=xlDescending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom

End Sub

Regards
Peter
-----Original Message-----
hi i have seen and tried the auto sort posts here but

none seem to work
in mine

then i tried in a new sheet and found that those worked

only in
numbers, when i try sorting a formula it doesnt work

i have a table like this:

Name Games Points
Team1 2 9
Team2 2 4
Team3 2 1

and so on; as the points are formulas, related to the

game results wich
there are also in the same sheet

is there a way to auto sort those point columns among

with the team
name column? the columns are N8 up to V16


---
Message posted from http://www.ExcelForum.com/

.


Crash[_5_]

Auto Sort Formulas
 
Do you have Absolute References? Change them to Relative. Then the sort
should work as long as all the variables are in the same row.

Sub TeamSort()

Application.Goto Reference:="TeamTable" 'Dynamic Range N$7$:V$16$
with headers

'Sorts by Points (descending) then by Team (Ascending)

Selection.Sort Key1:=Range("P8"), Order1:=xlDescending,
Key2:=Range("N8") _
, Order2:=xlAscending, Header:=xlYes, OrderCustom:=1,
MatchCase:=False _
, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2:= _
xlSortNormal
End Sub

Jon

leandrocg < wrote:

hi i have seen and tried the auto sort posts here but none seem to work
in mine

then i tried in a new sheet and found that those worked only in
numbers, when i try sorting a formula it doesnt work

i have a table like this:

Name Games Points
Team1 2 9
Team2 2 4
Team3 2 1

and so on; as the points are formulas, related to the game results wich
there are also in the same sheet

is there a way to auto sort those point columns among with the team
name column? the columns are N8 up to V16


---
Message posted from http://www.ExcelForum.com/




--
42°57N 81°16W



leandrocg[_2_]

Auto Sort Formulas
 
but i need to use absolute references, because if i use relatives, the
formulas get all messed up when i sort the table...

thx i will try your help


---
Message posted from http://www.ExcelForum.com/


leandrocg[_3_]

Auto Sort Formulas
 
hey guys, i tried you both macros but it didnt work...

what i really needed is a macro that would auto sort some formulas tha
use absolute reference (like the points), and copy the other value
among with them (like the team name, games etc.)

this is really getting me mad :

--
Message posted from http://www.ExcelForum.com


leandrocg[_4_]

Auto Sort Formulas
 
that's ok i got it fixed!
thx

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 12:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com