How to hide many pivotitem at once

tomluigi

New Member
Joined
Dec 10, 2018
Messages
9
Is there a way to hide a list of PivotItems in a single command?


Using Excel2010, standard pivot (not OLAP data source)


I'm looking for a way to significantly speed up the code execution.
NB I already suspended the recalculation, the video refresh, set .ManualUpdate = True, ...


So I'm looking for something like <lista_pivotitems> .hide (or .visible = False);
better Hide_list (pivotfield ("xx"), <comma_separates_string_of_value_to_hide>)


Let me explain better, if from the interface you select only a couple of entries in a pivotfield you get the result quickly; on the contrary, if this operation is performed with the macro recorder on, this is translated with n commands of the type
Code:
With ActiveSheet.PivotTables ("pDoc"). PivotFields ("pir_L4")
        .PivotItems ("1208 Costs"). Visible = False
        .PivotItems ("1221 - series"). Visible = False
        .PivotItems ("1231 - ILS"). Visible = False
..... and so on




If you then re-run the macro, the time is much greater (in my table there are many possible values to be negated)


Since I can do a massive operation via GUI it seems strange that I can not replicate it from VBA
I have been looking for a solution a lot on internet without success, any suggestions?


PS I have found that in the case of contiguous values ​​of a pivotitem the command can also be carried out
Code:
 range.delete [/ code] but this is not my case (not contiguos values also in for different
It seems that you do not reach the goal even passing through the sliders and their properties</comma_separates_string_of_value_to_hide></lista_pivotitems>
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Strangely for a forum so active no answer? Maybe I could not explain the problem clearly? If so please ask me for the necessary clarifications
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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