Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default Simple Sort question

Excel 97
Windows 2k Pro

I know that using Excel's built in Sort menu option that I can only sort up
to three columns at a time. I went ahead and recorded a sort as a macro to
get the basic code for doing this in VBA, so I was wondering if I can add a
4th, 5th or 6th sort key in the VBA code for the Macro. I've tried doing
this by mimicking the code but adding a 4th key, using the same syntax as
the macro code, but I got an "unknown object" error. Is it just not meant
to be?

-gk-


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Simple Sort question

You can record the steps as you perform multiple sorts. For example, you
may want to sort by Country, Region, City, LastName and FirstName.

LastName and FirstName are the least important fields in the sorting
process, so they can be sorted first. (DataSort, By LastName, then by
FirstName)

Then sort the remaining fields (By Country, then by Region, then by
City). Excel will retain as much as possible from the earlier sorts.


TBA wrote:
Excel 97
Windows 2k Pro

I know that using Excel's built in Sort menu option that I can only sort up
to three columns at a time. I went ahead and recorded a sort as a macro to
get the basic code for doing this in VBA, so I was wondering if I can add a
4th, 5th or 6th sort key in the VBA code for the Macro. I've tried doing
this by mimicking the code but adding a 4th key, using the same syntax as
the macro code, but I got an "unknown object" error. Is it just not meant
to be?


--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default Simple Sort question

If the functions in the freely downloadable file at
http://home.pacbell.net/beban are available to your workbook, you can
nest the ArrayRowFilter functions:

=ArrayRowFilter2(ArrayRowFilter1(ArrayRowFilter1(A rrayRowFilter1(ArrayRowFilter1(ArrayRowFilter1(dat arange,1stCol,1stCrit),2ndCol,2ndCrit),3rdCol,3rdC rit),4thCol,4thCrit),5thCol,5thCrit),6thCol,6thCri t)
array entered into a range sufficiently large to accommodate the final
output. Note that the first function is ArrayRowFilter2, the remainder
are ArrayRowFilter1. This is to avoid getting an error message if the
selected range is large enough for the final output but not large enough
for an intermediate output. If the selected range is not large enough
for the final output, the error message will indicate the range size to
be selected.

Alan Beban

TBA wrote:
Excel 97
Windows 2k Pro

I know that using Excel's built in Sort menu option that I can only sort up
to three columns at a time. I went ahead and recorded a sort as a macro to
get the basic code for doing this in VBA, so I was wondering if I can add a
4th, 5th or 6th sort key in the VBA code for the Macro. I've tried doing
this by mimicking the code but adding a 4th key, using the same syntax as
the macro code, but I got an "unknown object" error. Is it just not meant
to be?

-gk-



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
IF formula-simple question; simple operator Rich D Excel Discussion (Misc queries) 4 December 6th 07 03:36 PM
Simple sort Problem kevincanuk Excel Discussion (Misc queries) 2 November 22nd 06 08:05 AM
simple sort, but ... tfb Excel Discussion (Misc queries) 1 October 8th 06 06:43 PM
simple sort maacmaac Excel Discussion (Misc queries) 3 January 30th 06 08:22 PM
Simple Simple Excel usage question BookerW Excel Discussion (Misc queries) 1 June 23rd 05 10:06 PM


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