Can you consider this air code:
if sheet("Sort").exist thensheet("Sort").delete
worksheets.add
activesheet.name="Sort"
copy original table to sheet("Sort")
with sheet("Sort")
.range.sort keys1:=9, keys2=6, keys3:=4
.range.sort keys1:=1
end with
array=sheet("Sort").range
sheet("Sort").delete
Sort in reverse order IS the key.
Regards
KC@103
pynasocas
________________________________
From: "1z@compuserve.com" <1z@compuserve.com>
To: ExcelVBA@yahoogroups.com
Sent: Sunday, 8 January 2012, 3:20
Subject: Re: [ExcelVBA] Re: Sorting in VBA
Guys....
What I have so far is
1) Sort on the 1st column.
2) Do... through the data
Extract an array of items with the the same item/element
Sort on the next sig column.
Loop
This means that secondary array is always ok because all of the data in the "Extract" column is the same.. is my thinking anyroad.
It's the conditions for the looping back that have got me spinning.
So far I''m saving the start and end row of each extract... but it just doesn't work.
The consensus seems to be that I should go the other way around... least sig to most sig ** as long as the order of the previously sorted items is preserved **.
Have Io got that right?
Lisa
-----Original Message-----
From: David Braithwaite <dbraithwaite@charter.net>
To: ExcelVBA <ExcelVBA@yahoogroups.com>
Sent: Sat, Jan 7, 2012 7:39 pm
Subject: [ExcelVBA] Re: Sorting in VBA
Steve
From my point of view, you are on target.
Perhaps the thing missing in the concatenated key discussion is that you
eed to move the whole rows during an interchange. This is frequently no
n most example-sort routines.
If moving the data around is what you are trying to avoid then you can
reate and access the array via an indexList()
array(indexlist(m),column)], and only interchange indexlist entries;
eturning the indexlist() to the user for all subsequent accesses to the
orted array. A benefit of this is that you don't lose the original order
f the array.
Db
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.
----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA
----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com
----------------------------------
Tidak ada komentar:
Posting Komentar