Hi There,
I have a problem with some code which causes a pivot table to change.
The strange thing is that the code worked fine until I updated the pivot table with some new data from Microsoft Access, all the names are the same but all of a sudden I get "Run-time error 1004: Unable to set the _Default property of the PivotItem class"
The code highlighted with debug is the third line below:
Dim ckey As Variant
ckey = Range("CKey")
Sheets("Pivot").PivotTables("Pivot").PivotFields("C Key"). _CurrentPage = ckey
where CKey is the range containing the value I want the Pivot Table Field "C Key" to change to.
I found some suggestions from Microsoft on the web
(1) Insert code "ActiveCell.Activate" - doesn't work
(2)Change the value of the TakeFocusOnClick property to False for the button - there is no TakeFocusOnClick property
(3) Set the Autosort option for the Pivot Table Field to Manual - doesn't work
So frustrated...ahhhh!
Thanks a million to anyone who knows how to fix it.
I have a problem with some code which causes a pivot table to change.
The strange thing is that the code worked fine until I updated the pivot table with some new data from Microsoft Access, all the names are the same but all of a sudden I get "Run-time error 1004: Unable to set the _Default property of the PivotItem class"
The code highlighted with debug is the third line below:
Dim ckey As Variant
ckey = Range("CKey")
Sheets("Pivot").PivotTables("Pivot").PivotFields("C Key"). _CurrentPage = ckey
where CKey is the range containing the value I want the Pivot Table Field "C Key" to change to.
I found some suggestions from Microsoft on the web
(1) Insert code "ActiveCell.Activate" - doesn't work
(2)Change the value of the TakeFocusOnClick property to False for the button - there is no TakeFocusOnClick property
(3) Set the Autosort option for the Pivot Table Field to Manual - doesn't work
So frustrated...ahhhh!
Thanks a million to anyone who knows how to fix it.