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
 

Some videos you may like

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

Lewiy

Well-known Member
Joined
Jan 5, 2007
Messages
4,284
What problem are you having with it? It seems to run ok.
 

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
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.
 

oriches

New Member
Joined
Sep 12, 2007
Messages
27
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.
 

oriches

New Member
Joined
Sep 12, 2007
Messages
27
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
 

Watch MrExcel Video

Forum statistics

Threads
1,122,371
Messages
5,595,782
Members
414,020
Latest member
Meghdad

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
Top