Excel macro screenupdating false

Each field button has an arrow that opens a drop down list of items. To switch between Single Selection mode and Multiple Selection mode, click in the Select Multiple Items.checkbox, at the bottom of the list Instead of selecting pivot items manually, you can use a macro to show or hide multiple fields. The following code will show all items in all row fields, in ALL pivot tables on the active sheet.

excel macro screenupdating false-1

The following code hides all items, except the last item, in all row fields, in ALL pivot tables on the active sheet.

Excel will not allow you to hide all the items though -- at least one pivot item must be visible.

Screen Updating = True End Sub Instead of hiding pivot items manually, you can use a macro to show or hide multiple items. Dim pt As Pivot Table Dim pf As Pivot Field Dim pi As Pivot Item Application. Display Alerts = False On Error Resume Next For Each pt In Active Sheet.

Screen Updating = True End Sub Dim pt As Pivot Table Dim pf As Pivot Field Dim pi As Pivot Item Dim str PF As String On Error Resume Next Set pt = Active Sheet.

Pivot Tables(1) str PF = Input Box(str Prompt PF, "Enter Field Name") str PI = Input Box(str Prompt PI, "Enter Item") Set pf = pt.

Dim pt As Pivot Table Dim pf As Pivot Field Dim pi As Pivot Item Dim str Prompt PF As String Dim str Prompt PI As String Dim str PF As String Dim str PI As String On Error Resume Next str Prompt PF = "Please enter the name of the field you wish to filter." str Prompt PI = "Please enter the item you wish to filter for." Set pt = Active Sheet.

It affects the first pivot table on the active sheet.

The following code will prompt you for a field name and item name, and will hide all other items in the field.

Screen Updating = True End Sub Thanks to Jeff Bloomer, who contributed this code.

Tags: , ,