I have a macro that runs great in Win but not a Mac.
Error on mac is:
“Run time error ‘5’; Invalid procedure call or argument”
Statement flagged on Mac (the 1st and 2nd physical lines below are actually on 1 line, as are 3rd and 4th, so no need for underscore):
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase,
SourceData:=Selection.CurrentRegion.Address, Version:=6). _
CreatePivotTable TableDestination:="", TableName:="PivotTable1",
DefaultVersion:=6
Is there anything in that statement not supported on the Mac?
Windows environment:
- OS: Win 7 Professional
- Excel: MS Office 365 ProPlus, version 1708
Mac environment:
- MacOS: version 10.13.3
- Excel: 15.33
I can post the entire macro if necessary. Thought I’d start with just seeing if some obvious function/object isn’t supported on the MacOS version of Excel. Thanks.
This error can be caused by not having the proper references enabled/disabled in your project.
Go into the Visual Basic portion, click Tools (top left of the window) and then click References. Remove all MISSING:
references and re-run.
Note: I’m still pretty new to VBA, this has been how I’ve fixed the exact same error along with what I’ve found from a quick search of the error
Tags: excelexcel, vba, windows