I'm attempting to disable some of the dropdown boxes on a Pivot Table. I found a Thread by RORYA to disable all of the dropdown boxes (see below), and it works perfectly. I am, however, attempting to disable only some of the drop down boxes, not all. Is there a way to tweek the code below so that only some of the drop downs are disabled?
My Pivot table contains 8 Columns. I want to disable Columns D, E, and F, and leave all remaining drop down boxes functional. If it helps, the labels for the columns are, HC, Attainment, and Product.
Sub hidedrops()
Dim pf As PivotField, pt As PivotTable
Set pt = ActiveSheet.PivotTables(1)
On Error Resume Next
pt.ManualUpdate = True
For Each pf In pt.RowFields
pf.EnableItemSelection = False
Next pf
For Each pf In pt.ColumnFields
pf.EnableItemSelection = False
Next pf
For Each pf In pt.DataFields
pf.EnableItemSelection = False
Next pf
pt.ManualUpdate = False
End Sub
My Pivot table contains 8 Columns. I want to disable Columns D, E, and F, and leave all remaining drop down boxes functional. If it helps, the labels for the columns are, HC, Attainment, and Product.
Sub hidedrops()
Dim pf As PivotField, pt As PivotTable
Set pt = ActiveSheet.PivotTables(1)
On Error Resume Next
pt.ManualUpdate = True
For Each pf In pt.RowFields
pf.EnableItemSelection = False
Next pf
For Each pf In pt.ColumnFields
pf.EnableItemSelection = False
Next pf
For Each pf In pt.DataFields
pf.EnableItemSelection = False
Next pf
pt.ManualUpdate = False
End Sub