The macro recorder can be your friend
Sub Macro4()
'
' Macro4 Macro
' Macro recorded 9/6/2008 by Donald B. Guillett
'
'
Range("A1:C4").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
End Sub
amend to remove selection. Notice ALL dot placements for the with statement.
With Sheets("yoursheetname")
.Range("A1:C4").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
end with
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"Del Cotter" wrote in message
...
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.