Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Visible PivotItems matching criteria
How can I use -
With ActiveSheet.PivotTables("PivotTable1").PivotFields ("Ref") ..PivotItems("QM").Visible = True What I want to do is show anything that matches QM (i.e. "QM - 1" or "QM - 2") Any ideas, I can't use a * or LIKE in the code can I? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Visible PivotItems matching criteria
Hi Westg,
Check the value of the pivotitem using the LIKE operator. The LIKE operator is case sensitive. Something like this should work: Sub test() Dim pf As PivotField Dim pi As PivotItem Set pf = ActiveSheet.PivotTables("PivotTable1").PivotFields ("Ref") For Each pi In pf.PivotItems If Not (pi.Value Like "*QM*") Then pi.Visible = False End If Next Set pf = Nothing Set pi = Nothing End Sub Every item with a QM in the name should be visible and everything else should be hidden Regards, Mike "westg" wrote: How can I use - With ActiveSheet.PivotTables("PivotTable1").PivotFields ("Ref") .PivotItems("QM").Visible = True What I want to do is show anything that matches QM (i.e. "QM - 1" or "QM - 2") Any ideas, I can't use a * or LIKE in the code can I? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Controlling Pivotitems.visible | Excel Discussion (Misc queries) | |||
Pivot Change PivotItems - Visible/Hide with VBA | Excel Worksheet Functions | |||
Always keep the same 4 PivotItems visible | Excel Programming | |||
PivotItems.Count is 0 when items are visible on the sheet | Excel Programming | |||
Excel Pivot Tables, Page Fields, Visible PivotItems, Activation | Excel Programming |