Good morning,
I have my VB where the pivot table page filter is changed based on a list.
Using a For Next loop I have it run through the list and update the pivot table and save it, then go to the next item in the list. The problem I have is not all items in the list are in the pivot table and what happens is that the field I am telling it change to, overwrites the next one. For example, I have group called AAA and BBB. If AAA is not in the pivot table, it will change the name BBB to AAA and pull in BBB data. I want it to error out or something and not overwrite that field.
Here is my code.
The cell A1 is the value of the Item in the For Next loop. I want it so if it doesn't find the AAA in the pivot to do another action. I have the code for the other action. Thanks!
I have my VB where the pivot table page filter is changed based on a list.
Using a For Next loop I have it run through the list and update the pivot table and save it, then go to the next item in the list. The problem I have is not all items in the list are in the pivot table and what happens is that the field I am telling it change to, overwrites the next one. For example, I have group called AAA and BBB. If AAA is not in the pivot table, it will change the name BBB to AAA and pull in BBB data. I want it to error out or something and not overwrite that field.
Here is my code.
Code:
ActiveSheet.PivotTables("PivotTable4").PivotFields("Providerdept").CurrentPage _
= Range("A1").Value
Cells.Select
The cell A1 is the value of the Item in the For Next loop. I want it so if it doesn't find the AAA in the pivot to do another action. I have the code for the other action. Thanks!