L
livetohike
I write lots of simple macros (see below) to sort my data various
ways, but because the sort keys are associated to specific Columns,
each time I move columns around, the sort breaks. Is there some way
to write the sort such that it will still work after I move around
some columns? It is a pain to have to back and manyally update all the
cell names. Maybe using the Header Row names?
Seems like Excel is so very good at updating dell references when you
insert, delete, and move things around that there is probably a better
way to do this.
Sub SortByStateDisctrictSchool()
Cells.Select
Selection.Sort Key1:=Range("G2"), Order1:=xlAscending,
Key2:=Range("H2") _
, Order2:=xlAscending, Key3:=Range("A2"), Order3:=xlAscending,
_
Header:=xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom
End Sub
Using Excel 2000
Thanks
ways, but because the sort keys are associated to specific Columns,
each time I move columns around, the sort breaks. Is there some way
to write the sort such that it will still work after I move around
some columns? It is a pain to have to back and manyally update all the
cell names. Maybe using the Header Row names?
Seems like Excel is so very good at updating dell references when you
insert, delete, and move things around that there is probably a better
way to do this.
Sub SortByStateDisctrictSchool()
Cells.Select
Selection.Sort Key1:=Range("G2"), Order1:=xlAscending,
Key2:=Range("H2") _
, Order2:=xlAscending, Key3:=Range("A2"), Order3:=xlAscending,
_
Header:=xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom
End Sub
Using Excel 2000
Thanks