View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
merjet merjet is offline
external usenet poster
 
Posts: 812
Default Using the Sort Method

With Selection.Sort
vkey1 = .key1
vkey2 = .key2
End With

Unfortunately I got an "Unable to get the Sort property of the Range

class."
error.


If you do a sort with the macro recorder on, you get something like this:

Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Key2:=Range("B1") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:=
_
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2 _
:=xlSortNormal

Therefore, you need to change the syntax of your sort criteria.

HTH,
Merjet