Glory
Well-known Member
- Joined
- Mar 16, 2011
- Messages
- 640
Code:
Public Sub test()
[B][COLOR=darkgreen]Sheets("Pivot").Activate[/COLOR][/B]
Sheets("Pivot").PivotTables("PVT").PivotFields("NAME").CurrentPage = oName
Sheets("Pivot").PivotTables("PVT").PivotFields("DATE").CurrentPage = oDate
Sheets("Pivot").PivotTables("PVT").PivotFields("SHIFT").CurrentPage = oShift
End Sub
This code succeeds when the green line is added in. When that line is commented out, the code only succeeds if sheet "Pivot" is the active sheet. When sheet pivot is not the active sheet, the code fails.
Is there a way to manipulate a pivot table on an inactive sheet?