error in macro when running on Mac

B

BeSmart

Version: 2004
Operating System: Mac OS X 10.5 (Leopard)
Processor: Intel

I'm a newbie who has just converted to Mac so I apologise if I get anything wrong or don't explain things well.

I need to continue running and editing macros that were created on my windows laptop. Therefore I've installed office 2004 for Mac on my new Mac.

These macros must run on both the Mac and on Windows PC after I've edited/created them - all users are still using windows PC's.

I tried to run an existing macro (that was created on my windows XP laptop using Office excel 2003) but I got an error regarding updating part of an existing pivot table, It's debugging on selecting all the pivot table data, copying it and pastes values only into another section on the worksheet.

The error msg on the Mac is:

Run-time error '450':
Wrong number of arguments or invalid property assignments

The debug highlights the line after the "*" in the code below:

Range("L157").Select
Selection.CurrentRegion.Clear

* ActiveSheet.PivotTables("PivotTable4").PivotSelect "", xlDataAndLabel, True
Selection.Copy
Range("L157").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _xlNone, SkipBlanks:=False, Transpose:=False

I tried to re-create the action in excel for Mac and use that instead - but when I ran it on the windows PC it debugged over there.

I need to re-write this so it runs in both excel for mac and excel for windows...

Any help would be greatly appreciated.
 
J

JE McGimpsey

Version: 2004
Operating System: Mac OS X 10.5 (Leopard)
Processor: Intel
I need to re-write this so it runs in both excel for mac and excel for
windows...

VBA6, which WinXL versions *after* XL97 use, has the UseStandardName
optional parameter in the PivotSelect method.

VBA5, which WinXL97 and MacXL98->04 use, doesn't.

So try:

ActiveSheet.PivotTables("PivotTable4").PivotSelect "", xlDataAndLabel
 

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

Top