what is wrong with this macro line...

oriches

New Member
Joined
Sep 12, 2007
Messages
27
what is wrong with this macro line?

Sheets("Data1").Range("I5:J1003").Sort Key1:=Range("J5"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

Cheers

Ollie Riches
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Two possibilites:

1 Range("J5") is missing a worksheet qualification like:

Key1:=Sheets("Data1").Range("J5")

2 The DataOption1 argument doesn't exist in earlier versions of Excel.
 
Upvote 0
it is showing this in themacro debugger:

Run-time error '1004':

The sort reference is not valid. Make sure that it's within the data you want to srt, and the first Sort By box isn't the same or blank.
 
Upvote 0
Two possibilites:

1 Range("J5") is missing a worksheet qualification like:

Key1:=Sheets("Data1").Range("J5")

2 The DataOption1 argument doesn't exist in earlier versions of Excel.

Thanks for the help, it was no. 1

Cheers

Ollie Riches
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,692
Members
448,979
Latest member
DET4492

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top