Macro runs in some computers, in others not...

afonsoac

New Member
Joined
Jul 9, 2018
Messages
1
Hello all,

I created a macro that creates a pivot table based on a dynamic range, in order to generate a report.
When I run it in my computer, everything goes ok, however, when I run it in someother computers, the follow error message appears:

Run-time error '5':
Invalid procedure call or argument

When I debug, I can see the problem lies in this code:

ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Dados!A1:AU" & nlinhas, Version:=6).CreatePivotTable TableDestination:= _
"Report_DR!R11C1", TableName:="PivotTable1", DefaultVersion:=6

I already changed some excel options related with Trust Center, however the problem persists.

What can I do?

Thank you.
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Are they using the same version of Excel as you are? You're specifying Excel 2016, I believe.
Also, does the SourceData exist? Does the Destination?
Finally - is there another pivot table named PivotTable1?
 
Upvote 0

Forum statistics

Threads
1,214,639
Messages
6,120,679
Members
448,977
Latest member
dbonilla0331

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
Back
Top