View Single Post
  #28   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default Modify Claus code "Sub Array_Var_Column_Sort()"

Hi Garry,

Am Sat, 23 Aug 2014 11:48:28 -0400 schrieb GS:

This is not needed.
Why End(xlUp) instead of...


Howard had this error and wondered why he had a wrong result.
I told him to use End(xlToLeft) instead of End(xlUp) ;-)


I did also and so it's just a remnant from the original code!<g

Your macro works to sort each column.


Yes.., that's what I was trying to sort out.

My suggestions was for sorting in 2 or more levels with the
Sort.Fields.Add method:
First by column A, then by column E and then by column I.
In that case if you enter the key with the whole range address e.g.
Key:=Range("A1:A20") the data outside the table still remains.
If you write Key:=Range("A1") outside data will be sorted too.


It seemed to me when I looked at your code that we had come to the same
page regarding approach. I do see your point after a reread; ..it makes
sense. -Thanks for pointing this out!

I decided to build this into a reusable routine, but wanted to get the
sorting limited to rngToSort. I just wanted to let you know where it
was at when I stopped yesterday. I'll probably include your suggestion
after I play with it, but won't get back to it for a bit because I'm
busy with modifying the folding ramp of my wheelchair van so it extends
the outer section sooner for parallel parking at curbs.

Ultimately, I want a Bool function so I can trap failure. Also,
sCriteria$ will become vCriteria() so I can pass the ColsToSort list
and control the 'With .Sort' parameters. I'll likely rename this
"SheetSort_Cols" and add "SheetSort_Rng" to simplifying coding for
contiguous data. "SheetSort_Cols" will assume including all data
between 1st/last cols. I already have sort Bool functions for doing
individual cols/rows ("RngSort") and range 'areas' ("BlockSort"). I'll
probably end up duplicating this with "SheetSort_" routines.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion