Macro runs on one computer and get run time error 5 on another

LenaMWork

New Member
Joined
Aug 4, 2015
Messages
13
Hello!

I run a macro on one computer and it is fine
And on another it gives me the run time error 5: invalid procedure call or argument

This is the code he doesn`t like:


ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
Range(Cells(1, 1), Cells(R, C)), Version:=xlPivotTableVersion15).CreatePivotTable _
TableDestination:="ProjectsOW!R3C1", TableName:="PivotTable3", DefaultVersion _
:=xlPivotTableVersion15

Please help!
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Welcome to the board. Are the Excel versions the same on each PC?
 
Upvote 0
It is ok!

It works now!

You were right, it`s the different version of the pivot tables.
As soon as I changed it from 15 to 14 it worked like a charm!
It didn`t work at first since I forgot to change in all the places in the code

Thank you so much!!!!
You saved me :)
 
Upvote 0
Please post your full code

It is ok!

It works now!

You were right, it`s the different version of the pivot tables.
As soon as I changed it from 15 to 14 it worked like a charm!
It didn`t work at first since I forgot to change in all the places in the code

Thank you so much!!!!
You saved me :)
 
Upvote 0
You're welcome.

PS You don't need to quote every comment in your replies or post double replies either!
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

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