AddItem directly to a Pivot Table's cache?

Glory

Well-known Member
Joined
Mar 16, 2011
Messages
640
Is it necessary to update the source range, or is it possible to use VBA to add and remove items to and from a pivot table's cache?
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
You need to update the source range. However, one way to accomplish this without having to MANUALLY update the source range would be to insert a column that lies inside of the range.

For example, if your source range is A1:M100, you can insert a column anywhere in that, and the source range will automatically change to A1:N100.
 
Upvote 0
It's a sure thing then? That seems so counter-intuitive. I'm yearning for some obscure method that will let me jailbreak the pivot table's cache.

It might seem like an arbitrary difference, but the point is that all I need to be able to do is to select an entry from a pivot field when that entry happens not to appear in the pivot field. That requires the number to be present in the pivot field (and if I don't want to add it every time the file opens, the pivot table cache), but not the source range.

Adding information to the source that isn't already there will seem really unappealing to the people requesting this tool. But I guess what they don't know won't hurt them.

I've been boning up on class modules to the best of my ability. I got one working tonight that gave me a checkbox. I've just bumped the post on that one for the... fourth time I think?

I'm real close now though. I've got everything working except the thing that will check to make sure projects are present (since I can't edit the pivot cache directly), the thing that will select the numbers from the pivot field, and the runtime controls that are coded.

Real close, and it feels real good.
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,750
Members
452,940
Latest member
rootytrip

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