Set selection of Pivot Table using VBA
Hi Charles,
your posting helped me very much!
Now everything works flawlessly, but now I tried to change also the
term, not only the quarter.
Term can only take values "1", "2", "(All)".
It works without any problem if you choose 2 or (All), but if you
choose 1, I get the error message "Unable to set the _Default property
of the PivotItem class".
My code now looks like this:
Private Sub Worksheet_Change(ByVal Target As Range)
Sheets("OverallView").Select
ActiveSheet.PivotTables("PivotTable3").PivotFields ("Quarter").CurrentPage
= CStr(Worksheets("ExecutiveS").Range("F4"))
ActiveSheet.PivotTables("PivotTable3").PivotFields ("Term").CurrentPage
= CStr(Worksheets("ExecutiveS").Range("F5"))
Sheets("ExecutiveS").Select
End Sub
You think you can help me again?
|