View Single Post
  #1   Report Post  
RestlessAde
 
Posts: n/a
Default VB Corrupting Pivot Tables

Hi,

I have found that using the following code I am able to corrupt the data in
my pivot table:

On Error Resume Next
ActiveSheet.PivotTables("PTMonthlyAnalystSalesPA") .PivotFields("PA").CurrentPage = ActiveSheet.Range("B1").Value
If Err Then
ActiveSheet.PivotTables("PTMonthlyAnalystSalesPA") .PivotFields("PA").CurrentPage = "(blank)"

What I have found is that values in the PA page field are changed, even
though the actual data source has not. For example, my list used to contain
the name "Alex", but this is replaced with "Steve". In the data source
"Steve" is not referenced in the SA column. If I select Steve, it pulls the
data for Alex!

If you refresh this doesn't make a difference. If you replace the pivot
table with an identical table it returns to normal, until I start running
this code again.

Has anyone encountered this problem and can advise how I can avoid this?

Thanks,
Ra