Macro for pivot tables Error

arnevos

New Member
Joined
Feb 9, 2012
Messages
23
Hello,

I want to create a macro that automatically puts my data in a pivot table. When I record the macro and run it the first time there is no problem, but when I mail this file to a collegue and he tries the same macro again (CTRL + m) he gets an error:

Can anybody help me? I have included the file:


https://app.box.com/s/crta6mv6umos8u1b18s1gu4w1idys7lc

Thanks in advance!!
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
What error does he get?
 
Upvote 0
What error does he get?


ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Export 2015 !R1C1:R1048576C17", Version:=xlPivotTableVersion15). _
CreatePivotTable TableDestination:="2015!R3C1", TableName:="Draaitabel1", _
DefaultVersion:=xlPivotTableVersion15

If you press CTRL + m in the file you will see the full error
 
Upvote 0
If you press CTRL + m in the file you will see the full error

How do you know that, if it works for you?

Does your colleague have Excel 2013? If not, you need to change xlPivotTableVersion15 to xlPivotTableVersion14 (or leave out the version).
 
Upvote 0

Forum statistics

Threads
1,207,108
Messages
6,076,590
Members
446,215
Latest member
userds5593

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