Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 407
Default Sorting Issues

I inherited a macro that sorts in descending order (the first key, actually,
I am happy to eliminate the 2nd key if that helps), but seems to put any
blank entries (first key and 2nd key are either both blank or non-blank, I
think) at the top, whereas I would prefer they be ignored or, if that is
difficult, be put at the bottom. I would think, considering the first sort
is a descending number , that a blank would be put at the bottom, but I
guess I am wrong since they seem to be at the top. Here is the macro:

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

I cannot seem to figure out how to change this if I do it manually in EXCEL,
so perhaps there is no easy way, in which case I need to be more creative,
such as assigning zeroes instead of blanks, and then somehow eliminating the
zeroes later.

Thanks
Dean


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Sorting Issues

According to the Excel help file for default sort order, blanks should be
last for Ascending or Descending order. Only visible characters and space
are reversed, so maybe those are spaces instead of blanks.

"Dean" wrote:

I inherited a macro that sorts in descending order (the first key, actually,
I am happy to eliminate the 2nd key if that helps), but seems to put any
blank entries (first key and 2nd key are either both blank or non-blank, I
think) at the top, whereas I would prefer they be ignored or, if that is
difficult, be put at the bottom. I would think, considering the first sort
is a descending number , that a blank would be put at the bottom, but I
guess I am wrong since they seem to be at the top. Here is the macro:

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

I cannot seem to figure out how to change this if I do it manually in EXCEL,
so perhaps there is no easy way, in which case I need to be more creative,
such as assigning zeroes instead of blanks, and then somehow eliminating the
zeroes later.

Thanks
Dean



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 407
Default Sorting Issues

Let me check into that. Thanks.

"JLGWhiz" wrote in message
...
According to the Excel help file for default sort order, blanks should be
last for Ascending or Descending order. Only visible characters and space
are reversed, so maybe those are spaces instead of blanks.

"Dean" wrote:

I inherited a macro that sorts in descending order (the first key,
actually,
I am happy to eliminate the 2nd key if that helps), but seems to put any
blank entries (first key and 2nd key are either both blank or non-blank,
I
think) at the top, whereas I would prefer they be ignored or, if that is
difficult, be put at the bottom. I would think, considering the first
sort
is a descending number , that a blank would be put at the bottom, but I
guess I am wrong since they seem to be at the top. Here is the macro:

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

I cannot seem to figure out how to change this if I do it manually in
EXCEL,
so perhaps there is no easy way, in which case I need to be more
creative,
such as assigning zeroes instead of blanks, and then somehow eliminating
the
zeroes later.

Thanks
Dean





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 Issues Blissfully Ignorant Excel Discussion (Misc queries) 3 October 27th 08 06:44 PM
Sorting issues Wereman Excel Discussion (Misc queries) 2 September 4th 08 04:10 PM
Sorting issues KKT Excel Worksheet Functions 2 June 16th 08 01:36 PM
Sorting issues... JNW Excel Programming 2 March 22nd 07 06:22 PM
Issues with sorting Matthew McManus Excel Discussion (Misc queries) 1 June 29th 05 12:34 PM


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