Selecting PP sourced PT item

mikeymay

Well-known Member
Joined
Jan 17, 2006
Messages
1,632
Office Version
  1. 365
Platform
  1. Windows
Note - This was posted in the Excel forum with no response but I think this is more at home in this forum. Apologies for any rules broken

I have a pivot table that has names in the Row.

This PT is a source for a bar chart that needs to show each individual person in the bar chart (basically one bar).

I thought the best way to do this was to loop through the names and filter in the pivot table to show just the one person.

The code that is recorded doesn't want to work when I amend to use a string variable for the name
VBA Code:
ptPivotTable.PivotFields("[My Accounts Region].[Proper Name].[Proper Name]").VisibleItemsList = Array("[My Accounts Region].[Proper Name].&[" & strPerson & "]")
I am really struggling with this as it looks like it should be very simple but I can't find anything on the net to help.


TIA
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Forum statistics

Threads
1,223,799
Messages
6,174,669
Members
452,576
Latest member
AlexG_UK

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