Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help!, macro error appears on one computer but not on another, 1

Status
Not open for further replies.

Firery

Technical User
Sep 23, 2003
18
AU
I am running Office XP Pro at home. I created an excel workbook with macros. some macros sort data within a range.
My home computer runs all macros correctly with no errors.
I take the same program to work (Office 2000) and get syntax error at the point of sorting the data in the range selected.

I don't know why one computer will run the program and the other will not.
Macro Securities are set the same.

 
Strip the macro down to the smallest form that exhibits the problem (works on one computer but not the other) and post the code here. Maybe someone can spot what's going wrong.
 
Long shot but: You are not using any functions in the sheet that have not been enabled on the works machine but are on the home one?

Keith
 
I've noticed the same thing, the sort parameters in Office XP & Office 200 are different. If you do a manual sort in both versions & record a macro & compare, you will see the difference. If I'm not mistaken, a sort macro written to work in 2000 will work in XP, but not vice versa.

Paul Beddows
Avaya Implementation
Telus
Vancouver, Canada
E-mail via
 
Further to above, rewrite the sorting portion of the macro at work in office 2000, and then cut & paste it into the XP macro. That should solve your problem.

Paul Beddows
Avaya Implementation
Telus
Vancouver, Canada
E-mail via
 
Thank you all for your help, 'Paul Beddows' got it right.
this is the script from my XP macro

Range("A1:D30").Select
Selection.Sort Key1:=Range("B1"), Order1:=xlAscending, Key2:=Range("D1") _
, Order2:=xlAscending, Header:=xlNo, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2:= _
xlSortNormal

The difference was the 'DataOption' part on the end which Office 2000 didn't recognise, removing these fixed the problems.
Thanks again.
Tony
 
You must have simply forgotten Paul's Star for being a helpful post, so I'll rectify that for you :)

Regards
Ken................

----------------------------------------------------------------------------
Attitude - A little thing that makes a BIG difference
----------------------------------------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top