Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How to write a macro to uncheck the (ALL) item in a pivot table field? After
that step, I will check the items that I want. Thanks! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Actually what I want is a macro to check/select only few pivot items from a
pivot field that has more than hundred pivot items. Thanks! "HKS" wrote: How to write a macro to uncheck the (ALL) item in a pivot table field? After that step, I will check the items that I want. Thanks! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It should be done other way
- Select(check) all the items - uncheck the one you wish to filter out. Sub filterPivotRowFileds() cntItem = 0 Dim arrVisibleItems arrVisibleItems = Array("1", "2") ' Fill in the items you want to display in pivot For Each pvtRowItem In ActiveSheet.PivotTables("PivotTable1").PivotFields ("Severity").PivotItems ' update the pivot name and row field name pvtRowItem.Visible = True cntItem = cntItem + 1 Next pvtRowItem If cntItem < UBound(arrVisibleItems) Then MsgBox "array has more items than listed in pivot" Exit Sub End If For Each pvtRowItem In ActiveSheet.PivotTables("PivotTable1").PivotFields ("Severity").PivotItems If Not (arrSearch(pvtRowItem.Value, arrVisibleItems)) Then pvtRowItem.Visible = False End If Next pvtRowItem End Sub Public Function arrSearch(strSearch As String, arrStrToBeSearched As Variant) As Boolean For i = 0 To UBound(arrStrToBeSearched) If strSearch = arrStrToBeSearched(i) Then arrSearch = True Exit Function End If Next i arrSearch = False End Function On Aug 28, 12:38*am, HKS wrote: Actually what I want is a macro to check/select only few pivot items from a pivot field that has more than hundred pivot items. Thanks! "HKS" wrote: How to write a macro to uncheck the (ALL) item in a pivot table field? After that step, I will check the items that I want. Thanks! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
pivot table calculated field or item | Excel Worksheet Functions | |||
pivot table calculated field or item | Excel Discussion (Misc queries) | |||
Need Help Using Calculated Field or Item in Pivot Table | Excel Worksheet Functions | |||
Pivot Table Calculated Field / Item | Excel Programming | |||
Delete item from Pivot Table field? | Charts and Charting in Excel |