I have a large Pivot Table report that uses up to 8 page views. It has 4 standard views that the user controls with code in command buttons. I am looking for a way that if the user changes the view, but a pivotfield is in the correct position, that it will not recalculate the pivot table, as this can take up to 30 seconds. I would like to have an IF statement that would first check to see it the pivotfield is in the correct position before it moves it to the correct position.
The below code does not work, but this is what I am trying to accomplish:
If With ActiveSheet.PivotTables("Pivot1").PivotFields"City")_
.Orientation = xlPageField.Position <> 6 Then
With ActiveSheet.PivotTables("Pivot1").PivotFields("City")
.Orientation = xlPageField
.Position = 6
End With
This is just one example as the report would change the position of various PivotFields to different PageField and RowField positions.
Any thoughts? Thanx for looking..
The below code does not work, but this is what I am trying to accomplish:
If With ActiveSheet.PivotTables("Pivot1").PivotFields"City")_
.Orientation = xlPageField.Position <> 6 Then
With ActiveSheet.PivotTables("Pivot1").PivotFields("City")
.Orientation = xlPageField
.Position = 6
End With
This is just one example as the report would change the position of various PivotFields to different PageField and RowField positions.
Any thoughts? Thanx for looking..