How to fix/upgrade .sort in Excel 2007

O

ofergr

Hi.

I have a nice little macro that was activated when I pressed a button
in my Excel worksheet:
This command was part of the worksheet and it worked like a charm in
Excel XP.
I upgrade to Excel 2007, and not I get a runtime error.

The code was:
Private Sub CommandButton8_Click()
sort "SquadRow", xlAscending
End Sub

The Error I get is: Compile Error, Invalid use of property.

How should I fix my code to run in Excel 2007.

Thanks for the help,
Ofer
 
J

Jim Cone

It appears you didn't get all of the XP code copied over to 07.
The code you posted won't work in any XL version.
It should look something like...
Range("B5:D50").Sort Range("C5")
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


<[email protected]>
wrote in message
Hi.
I have a nice little macro that was activated when I pressed a button
in my Excel worksheet:
This command was part of the worksheet and it worked like a charm in
Excel XP.
I upgrade to Excel 2007, and not I get a runtime error.

The code was:
Private Sub CommandButton8_Click()
sort "SquadRow", xlAscending
End Sub

The Error I get is: Compile Error, Invalid use of property.
How should I fix my code to run in Excel 2007.
Thanks for the help,
Ofer
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Sort bug on Excel 2007 6
Sort problem in Excel 2007 3
Excel How to Fix Damaged Excel File That Won't Open? 3
Option Button in Excel 2007 and 2010 0
vba in excel 2007 5
VBA Sort 4
Sort code fails 1
Sort in hidden page crach 8

Top