Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
HKS HKS is offline
external usenet poster
 
Posts: 10
Default Macro to uncheck the (ALL) item in a pivot table field

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   Report Post  
Posted to microsoft.public.excel.programming
HKS HKS is offline
external usenet poster
 
Posts: 10
Default Macro to uncheck the (ALL) item in a pivot table field

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   Report Post  
Posted to microsoft.public.excel.programming
Avi Avi is offline
external usenet poster
 
Posts: 29
Default Macro to uncheck the (ALL) item in a pivot table field

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
pivot table calculated field or item craig Excel Worksheet Functions 4 February 1st 10 02:43 AM
pivot table calculated field or item craig Excel Discussion (Misc queries) 0 January 29th 10 04:08 AM
Need Help Using Calculated Field or Item in Pivot Table sg[_2_] Excel Worksheet Functions 1 June 28th 07 03:28 PM
Pivot Table Calculated Field / Item tc69 Excel Programming 2 May 11th 07 09:14 PM
Delete item from Pivot Table field? Stephen Charts and Charting in Excel 1 September 23rd 05 04:46 PM


All times are GMT +1. The time now is 11:59 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"