LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Sort breaks when columns are move around

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
 
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
unable to move page breaks Robin Excel Worksheet Functions 1 August 1st 05 06:37 PM
Move page breaks programmatically... Theresa Smallwood Excel Programming 6 July 13th 05 03:12 PM
Move page breaks Judy Excel Discussion (Misc queries) 1 June 23rd 05 11:44 PM
why can't I move page breaks? greensward Excel Discussion (Misc queries) 1 May 2nd 05 10:16 PM
move page breaks Laura Excel Worksheet Functions 1 March 31st 05 02:16 AM


All times are GMT +1. The time now is 11:44 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"