View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
mikearelli mikearelli is offline
external usenet poster
 
Posts: 10
Default 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?