Sorting Issues

  • Thread starter Thread starter Dean
  • Start date Start date
D

Dean

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
 
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.
 
Let me check into that. Thanks.

JLGWhiz said:
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.
 
Back
Top