VBA to add/remove columns in pivot based on dropdown selection

aravindhan_31

Well-known Member
Joined
Apr 11, 2006
Messages
672
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi All, Hope are doing well :)

Need an help with vba for playing with Pivots .

If I Select Technical in Cell B3 and run macro, then all columns related to Technical should be visible in the below pivot (a look up table can be created like below columns Q&R.
If I have to do this now, I will have to go to the fields list select one by one. If I have to change Technical to non Technical, then I have remove one set and again add, as a user finding little difficult to do this, coz the number of columns under Technical and Non Technical are many and looking for some smart ways where User select from the dropdown and click ok, then all those relevant fields should be added in the pivot in value fields.
Attached the excel file as well for reference
In short if I can get list of columns in the slicer, that would solve this problem, however not sure if that do-able, hence looking for some solutions.

1646047863592.png


Thanks for your help.
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Forum statistics

Threads
1,214,641
Messages
6,120,685
Members
448,977
Latest member
dbonilla0331

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