Getting Run time Error 5 when Creating a Pivot Table

gate68

New Member
Joined
Jun 6, 2008
Messages
34
I am creating 10 pivot tables for data in one worksheet and putting them in a separate work sheet. i used the macro recorder but the cod eit worte stop at this line

ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
"'RCH&BEA'!C2").CreatePivotTable TableDestination:="'RCH&BEA PIVOT TABLES'", TableName:= _
"RCH&BEA PIVOT TABLES", DefaultVersion:=xlPivotTableVersion10

The error i get is that run time error 1004 where it says this command requires atleast two rows of source data. It also says something about specifically about pivot tables but it cuts it off
 
I am using it but what is happening is that it will only pick the second line of .addfield code for row field. The new field that i am adding is just labeling the charts
 
Upvote 0

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
I'm afraid I have no idea what you mean.
 
Upvote 0
Rich (BB code):
 With ptRNT
      .AddDataField .PivotFields("Date"), "Count of Date", xlCount
      .AddFields RowFields:="Issue"
      .AddFields RowFields:="Date"

What happend is it skips over issue add field and just puts the Date in
 
Upvote 0
Try combining the two:
Rich (BB code):
.AddFields RowFields:=Array("Issue", "Date")
</pre>
 
Upvote 0

Forum statistics

Threads
1,214,590
Messages
6,120,423
Members
448,961
Latest member
nzskater

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