ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sort data failure (https://www.excelbanter.com/excel-programming/291456-sort-data-failure.html)

Robert Pollock[_2_]

Sort data failure
 
I am trying to sort data in two columns that in effect are
merged in different ways.

Explanation : H7 to J7 merged and K7 to L7 merged
H8 to L8 merged and K8 to L8 merged
and so on.

here is my routine;

Sub Sortdata2()
Range("H7:L13").Select
Selection.Sort Key1:=Range("H7:J7"), Order1:=xlAscending,
Key2:=Range("K7:L7") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1,
MatchCase:= _
False, Orientation:=xlTopToBottom
End Sub

However I get a run error 1004 - where am I going wrong ?

Thanks
Robert Pollock


Tom Ogilvy

Sort data failure
 
Key1 and key2 are not going to accept a multicell range. Can you sort this
range manually - My impression is that sort doesn't work well with merged
cells.

--
Regards,
Tom Ogilvy

"Robert Pollock" wrote in message
...
I am trying to sort data in two columns that in effect are
merged in different ways.

Explanation : H7 to J7 merged and K7 to L7 merged
H8 to L8 merged and K8 to L8 merged
and so on.

here is my routine;

Sub Sortdata2()
Range("H7:L13").Select
Selection.Sort Key1:=Range("H7:J7"), Order1:=xlAscending,
Key2:=Range("K7:L7") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1,
MatchCase:= _
False, Orientation:=xlTopToBottom
End Sub

However I get a run error 1004 - where am I going wrong ?

Thanks
Robert Pollock





All times are GMT +1. The time now is 02:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com