LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Junior Member
 
Posts: 1
Default Runtime error 1004 Application-defined or object defined error" on data sort

Hi,

I receive the error message mentioned above using the following macro:

Application.Goto Reference:="Data"
Selection.Sort Key1:=Range("P12"), Order1:=xlDescending, Key2:=Range("B12"), Order2:=xlAscending, Key3:=Range("M12"), Order3:=xlAscending, Key4:=Range("K12"), Order4:=xlAscending, Header:=xlNo _
, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

I do not receive any error message with the following macro (which has one less sort key):

Application.Goto Reference:="Data"
Selection.Sort Key1:=Range("P12"), Order1:=xlDescending, Key2:=Range("B12"), Order2:=xlAscending, Key3:=Range("M12"), Order3:=xlAscending, Header:=xlNo _
, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

I can interchange Key3 in the above macro from Range("M12") to Range("K12") without receiving an error message, so it can't be down to the format of the data in column K.

Any help would be appreciated.

Thanks

Chris
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Runtime error 1004- application defined or object defined error Novice Excel Programming 11 February 6th 06 11:02 PM
Runtime error 1004- application defined or object defined erro Novice Excel Programming 0 February 6th 06 09:34 PM
Runtime error 1004- application defined or object defined error Jim Thomlinson[_5_] Excel Programming 0 February 6th 06 09:33 PM
Runtime error 1004- application defined or object defined erro Novice Excel Programming 1 February 6th 06 09:33 PM
Runtime error 1004- application defined or object defined erro Jim Thomlinson[_5_] Excel Programming 0 February 6th 06 09:29 PM


All times are GMT +1. The time now is 05:21 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"