View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Sorting a named range using first three columns

With worksheets("someworksheetnamehere").range("Sort_Ro ws")
.sort key1:=.columns(1), Order1:=xlAscending, _
key2:=.Columns(2), order2:=xlAscending, _
key3:=.Columns(3), order3:=xlAscending, _
header:=xlNo, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
end with

Del Cotter wrote:

I have a macro that reads:

Application.Goto Reference:="SORT_ROWS"
Selection.Sort Key1:=Range("SORT_ROWS"), _
Order1:=xlAscending, Header:=xlNo, _
Orientation:=xlTopToBottom

It sorts the pre-defined range SORT_ROWS by row, using the first column
as the primary key.

How do I get it to sort using the first *three* columns as primary,
secondary and tertiary keys?

--
Del Cotter
NB Personal replies to this post will send email to ,
which goes to a spam folder-- please send your email to del3 instead.


--

Dave Peterson