View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] peter.tilm@gmx.de is offline
external usenet poster
 
Posts: 1
Default Selection.sort Run-time error '1004'

Hello,

I've got a problem when trying to sort a selection (Range of a
worksheet). Here is the code snipped (similar to the one recorded with
record a macro):

With QACPackageWS
Set rng = .Range(.Cells(1, 1), .Cells(row, col))
rng.Select
Selection.Sort Key1:=Range("E2"), Order1:=xlDescending,
Key2:=Range("G2") _
, Order2:=xlDescending, Header:=xlGuess, OrderCustom:=1,
MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2 _
:=xlSortNormal
End With

Excel/VBA stops program execution with a Run-time error '1004'.
Anyone a clue what i did wrong? Thanks for Support!

BR/
tilmp