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

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
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,214,832
Messages
6,121,851
Members
449,051
Latest member
excelquestion515

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