Dynamic data in PivotSelect statement
I have a table that changes daily that I am creating a pivot table from.
One day may show Item1 Item2 and Item3, but the next day the source data may only include Item2 and Item3 (no Item1) I would like to assign certain items to a group, but I never know which item will be in the source data for that day. ActiveSheet.PivotTables("PivotTable2").PivotSelect _ "Item["'Item1',"'Item2',"'Item3'"] 'ALL ITEMS'", xlDataAndLabel, True Selection.Group This statement works great if all 3 items are in the source data for today, but if Item2 is missing from the source data, I get an error and the group isn't created. How can I trap for the error and bypass? |
Dynamic data in PivotSelect statement
No Suggestions?
"mikearelli" wrote: I have a table that changes daily that I am creating a pivot table from. One day may show Item1 Item2 and Item3, but the next day the source data may only include Item2 and Item3 (no Item1) I would like to assign certain items to a group, but I never know which item will be in the source data for that day. ActiveSheet.PivotTables("PivotTable2").PivotSelect _ "Item["'Item1',"'Item2',"'Item3'"] 'ALL ITEMS'", xlDataAndLabel, True Selection.Group This statement works great if all 3 items are in the source data for today, but if Item2 is missing from the source data, I get an error and the group isn't created. How can I trap for the error and bypass? |
All times are GMT +1. The time now is 01:30 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com