k3vsmith
Member
Hello everyone, I'm looking for the best way to do this. Thinking an array...?
I recorded the following macro to do what I want in the pivot table but am looking for a better/streamlined solution.
I have a field in the Pivot table called RES CODE. I want to remove any that start with 9. For my given data this recorded macro works. But...There will be cases when running this macro that there will be more that the below 9#'s. Rather than just manually typing in each of our #'s that start with 9 and adding it to false I was wondering if I could make this alittle smarter and just have it make visible = False on ANY that start with 9?
Current Code:
I recorded the following macro to do what I want in the pivot table but am looking for a better/streamlined solution.
I have a field in the Pivot table called RES CODE. I want to remove any that start with 9. For my given data this recorded macro works. But...There will be cases when running this macro that there will be more that the below 9#'s. Rather than just manually typing in each of our #'s that start with 9 and adding it to false I was wondering if I could make this alittle smarter and just have it make visible = False on ANY that start with 9?
Current Code:
Code:
ActiveSheet.PivotTables("SIOPPivot").PivotFields("RES CODE").CurrentPage = _
"(All)"
With ActiveSheet.PivotTables("SIOPPivot").PivotFields("RES CODE")
.PivotItems("911.MATLS").Visible = False
.PivotItems("911.SUBCON").Visible = False
.PivotItems("921.CNTLBR").Visible = False
.PivotItems("921.ODC").Visible = False
.PivotItems("921.TRAVEL").Visible = False
.PivotItems("93.INTEROR").Visible = False
End With
ActiveSheet.PivotTables("SIOPPivot").PivotFields("RES CODE"). _
EnableMultiplePageItems = True
End Sub