Sorts don't save?

G

George

An using MS Office 2002 Excel. Have various worksheets that I always sort a
certain way... let's say address list is sorted by Column B, then Column A,
then Column C...and no header row.

Problem is... everytime I go to sort, I have to RE-ENTER this. Is there a
way to save it for a specific worksheet file? Not sure, but it seems like
some worksheets save it (it pops up with this sort criteria already in
tact), and others don't. (Already tried installing all latest
patches/updates)

Would appreciate ideas or if this is way it's supposed to work and why.
Thanks
 
D

Dave Peterson

Maybe you could record a macro when you do it next time. Then instead of
Data|sort, you could just play back that macro.

You could even plop a button from the Forms toolbar on the worksheet and assign
your macro to it. Then just click the button when you want to sort.
 
D

David McRitchie

Hi George,
Recorded a macro changed selection. to Cells
and xlGuess to xlNo -- even though I indicated no header when recorded.

You install this in your workbook or in your personal.xls
see http://www.mvps.org/dmcritchie/excel/getstarted.htm

Sub Sort_BAC_noHdr()
Cells.Sort Key1:=Range("B1"), Order1:=xlAscending, Key2:=Range("A1") _
, Order2:=xlAscending, Key3:=Range("C1"), Order3:=xlAscending, Header:= _
xlNo, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End Sub

If you would like to install it in a specific sheet (as you asked), you could
have it run on a double click. Event macros are installed differently.
Right Click on sheet tab, view code, plop the following code in.

Option Explicit
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Cells.Sort Key1:=Range("B1"), Order1:=xlAscending, Key2:=Range("A1") _
, Order2:=xlAscending, Key3:=Range("C1"), Order3:=xlAscending, Header:= _
xlNo, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End Sub

Another way would be to invoke the original macro if in same workbook,
if in personal.xls use: call personal.xls!Sort_BAC_noHdr

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
call Sort_BAC_noHdr
End Sub--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top