bryanrobson
New Member
- Joined
- Aug 19, 2022
- Messages
- 21
- Office Version
- 365
- Platform
- Windows
Hi. I have the below code which works well. I just need to amend it, so it shows anything with Q in it so *Q*. I tried changing the Is to a Like and also tried changing the "Q" to "*Q*" which it doesn't like.
Many thanks
Sub pivot_test()
Dim pt As PivotTable
Dim pi As PivotItem
Set pt = ActiveSheet.PivotTables("PivotTable1")
For Each pi In _
pt.PivotFields("Mc Type").PivotItems
Select Case pi.Name
Case Is = "Q"
pi.Visible = True
Case Else
pi.Visible = False
End Select
Next pi
End Sub
Many thanks
Sub pivot_test()
Dim pt As PivotTable
Dim pi As PivotItem
Set pt = ActiveSheet.PivotTables("PivotTable1")
For Each pi In _
pt.PivotFields("Mc Type").PivotItems
Select Case pi.Name
Case Is = "Q"
pi.Visible = True
Case Else
pi.Visible = False
End Select
Next pi
End Sub