#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Sorting a Selection

I use a particular spreadsheet everyday, and sort the data in three columns
of the worksheet many times (there is also other data that I do not sort). I
don't have a header row. Until recently, the spreadsheet seemed to know how
I wanted to sort, and the 'sort by' box always appeared with the sort by
defaulting to my previous criteria, seemingly remembering how I had sorted it
last time.

Recently something has happened, and every time I go to sort, first the
dialogue box comes up showing a header row, and when I change it to show no
header row, EACH time it defaults to "sort by column A", even though I always
sort this worksheet by columns B, C, and D. So now I have extra steps to
direct the sheet to sort by B-C-D everytime I want to sort.

Is there a setting somewhere, or was I just lucky before?

  #2   Report Post  
Junior Member
 
Location: Winters CA
Posts: 22
Default

If you select your range and call this routine, the sort dialog box will appear with your prefered settings as the default. You can change the settings before you choose to sort.
Code:
Sub SortWithDefaults()
Dim xval As Variant
xval = Application.Dialogs(xlDialogSort).Show(xlTopToBottom, _
            Range("b1"), xlAscending, _
            Range("c1"), xlAscending, _
            Range("d1"), xlAscending, xlYes, 1, False)

End Sub
Quote:
Originally Posted by MarkCA View Post
I use a particular spreadsheet everyday, and sort the data in three columns
of the worksheet many times (there is also other data that I do not sort). I
don't have a header row. Until recently, the spreadsheet seemed to know how
I wanted to sort, and the 'sort by' box always appeared with the sort by
defaulting to my previous criteria, seemingly remembering how I had sorted it
last time.

Recently something has happened, and every time I go to sort, first the
dialogue box comes up showing a header row, and when I change it to show no
header row, EACH time it defaults to "sort by column A", even though I always
sort this worksheet by columns B, C, and D. So now I have extra steps to
direct the sheet to sort by B-C-D everytime I want to sort.

Is there a setting somewhere, or was I just lucky before?
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Sorting a Selection

Thanks - now I'm really going to show my ignorance. What do I do with the
code you provided? Is it a macro?

The problem self corrected briefly when I changed the first item in row A to
something else (it had been in the A1 position for a long time). But after a
while it went back to default sort with a header row, which I never do with
this sheet.

Seems like it has a mind of its own.

Thanks again.


"mikerickson" wrote:


If you select your range and call this routine, the sort dialog box will
appear with your prefered settings as the default. You can change the
settings before you choose to sort.

Code:
--------------------
Sub SortWithDefaults()
Dim xval As Variant
xval = Application.Dialogs(xlDialogSort).Show(xlTopToBott om, _
Range("b1"), xlAscending, _
Range("c1"), xlAscending, _
Range("d1"), xlAscending, xlYes, 1, False)

End Sub
--------------------


MarkCA;509991 Wrote:
I use a particular spreadsheet everyday, and sort the data in three
columns
of the worksheet many times (there is also other data that I do not
sort). I
don't have a header row. Until recently, the spreadsheet seemed to
know how
I wanted to sort, and the 'sort by' box always appeared with the sort
by
defaulting to my previous criteria, seemingly remembering how I had
sorted it
last time.

Recently something has happened, and every time I go to sort, first the

dialogue box comes up showing a header row, and when I change it to
show no
header row, EACH time it defaults to "sort by column A", even though I
always
sort this worksheet by columns B, C, and D. So now I have extra steps
to
direct the sheet to sort by B-C-D everytime I want to sort.

Is there a setting somewhere, or was I just lucky before?





--
mikerickson

  #4   Report Post  
Junior Member
 
Location: Winters CA
Posts: 22
Default

It doesn't have a mind of its own, it just thinks you want it to be helpful rather than consistant.

Yes that is a macro.
To put it in your workbook, goto Tools-Macro-Visual Basic Editior
Insert a Module (not a class Module)
Copy the code from your web browser to the window.
Close the VB editor.

Use Excel's help system (keyword:=macro) to assign the routine to a button.




Quote:
Originally Posted by MarkCA View Post
Thanks - now I'm really going to show my ignorance. What do I do with the
code you provided? Is it a macro?

The problem self corrected briefly when I changed the first item in row A to
something else (it had been in the A1 position for a long time). But after a
while it went back to default sort with a header row, which I never do with
this sheet.

Seems like it has a mind of its own.

Thanks again.


"mikerickson" wrote:


If you select your range and call this routine, the sort dialog box will
appear with your prefered settings as the default. You can change the
settings before you choose to sort.

Code:
--------------------
Sub SortWithDefaults()
Dim xval As Variant
xval = Application.Dialogs(xlDialogSort).Show(xlTopToBott om, _
Range("b1"), xlAscending, _
Range("c1"), xlAscending, _
Range("d1"), xlAscending, xlYes, 1, False)

End Sub
--------------------


MarkCA;509991 Wrote:
I use a particular spreadsheet everyday, and sort the data in three
columns
of the worksheet many times (there is also other data that I do not
sort). I
don't have a header row. Until recently, the spreadsheet seemed to
know how
I wanted to sort, and the 'sort by' box always appeared with the sort
by
defaulting to my previous criteria, seemingly remembering how I had
sorted it
last time.

Recently something has happened, and every time I go to sort, first the

dialogue box comes up showing a header row, and when I change it to
show no
header row, EACH time it defaults to "sort by column A", even though I
always
sort this worksheet by columns B, C, and D. So now I have extra steps
to
direct the sheet to sort by B-C-D everytime I want to sort.

Is there a setting somewhere, or was I just lucky before?





--
mikerickson
Reply
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
Sorting Spreadsheet Selection - Recurring Sort MarkCA Excel Worksheet Functions 0 June 14th 07 08:41 PM
Identifying a selection of a selection of a range swimfast Excel Worksheet Functions 1 March 1st 07 02:51 AM
sorting data and expanding the selection Barnet1 Excel Discussion (Misc queries) 2 January 23rd 06 01:50 PM
Changing Selection for the "Center Across Selection" alignment johnandsuzie Excel Discussion (Misc queries) 1 January 18th 06 04:48 PM
why does sorting large columns create errors in top selection? Mitch Excel Worksheet Functions 1 November 17th 05 08:19 PM


All times are GMT +1. The time now is 11:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"