Run-time error '1004' help. Thank you

tommy1103

New Member
Joined
Jun 5, 2019
Messages
3
Hi all,

I'm attempting to write a macro that puts data into a pivottable automatically. This seems pretty simple, but I can't quite figure it out. I think there is a problem with the name of the table and location its going to? I'm not to sure. I'm getting the Run-time error '1004' Application-defined or object-defined problem. Thank you for the help. Here is the code:

Sub RegEd()
'
' RegEd Macro
'
' Keyboard Shortcut: Ctrl+q
'
Application.CutCopyMode = False
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Table1", Version:=6).CreatePivotTable TableDestination:="Sheet1!R4C22", _
TableName:="PivotTable4", DefaultVersion:=6
Sheets("Sheet1").Select
Cells(4, 22).Select
With ActiveSheet.PivotTables("PivotTable4")



Thanks again
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Update, i tried running it again (without changing anything) on a different workbook, and i got run-time error '5' Invalid Procedure Calls or Argument
 
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,269
Members
452,628
Latest member
dd2

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