View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
cm_gmail[_2_] cm_gmail[_2_] is offline
external usenet poster
 
Posts: 1
Default How "memorize/save" sort in ExcelXP


The easiest way is to record a macro. Something that you do frequentl
can be automated by simply using Tools|Macro|Record new macro. Then
just do your repetitive function and stop the recording.

For your example, I highlighted my data to get the selection before th
macro started so the selecting would not be part of the macro. Then,
hit Tools|Macro|Record new macro. Then, Data|Sort and filled it ou
how I wanted. Sorted and stopped the macro.

The resulting code was:

Code
-------------------
Selection.Sort Key1:=Range("A3"), Order1:=xlAscending, Key2:=Range("B3") _
, Order2:=xlDescending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2 _
:=xlSortNormal

-------------------


Not too bad. Pretty easy. From there, you edit the code if you wan
or leave it as-is.

If I did it frequently enough, I would create a toolbar button for th
macro.

Fun stuff. Good luck

--
cm_gmai
-----------------------------------------------------------------------
cm_gmail's Profile: http://www.excelforum.com/member.php...fo&userid=3345
View this thread: http://www.excelforum.com/showthread.php?threadid=53259