View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
John_John John_John is offline
external usenet poster
 
Posts: 40
Default Sorting a named range using first three columns

Hi!

Take a look at the example.
Created by macro recording.

'
'
Range("A1:C7").Select
Selection.Sort _
Key1:=Range("A2"), Order1:=xlAscending, _
Key2:=Range("B2"), Order2:=xlAscending, _
Key3:=Range("C2"), Order3:=xlAscending, _
Header:=xlGuess, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal, _
DataOption2:=xlSortNormal, _
DataOption3:=xlSortNormal
'
'

I hope it helps.

John

Ο χρήστης "Del Cotter" *γγραψε:


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.