Auto Sort Formulas

  • Thread starter Thread starter leandrocg
  • Start date Start date
L

leandrocg

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
 
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
 
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
 
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
 
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 :
 
Back
Top