Hi
I have a Drop Down / Combo box and when a value is selected I want it to change/update multiple pivot tables.
I am trying to get it to change for one pivot table first and I have the following code:
Sub DropDown1_Change()
ActiveSheet.PivotTables("PivotTable1").PivotFields("SMS").CurrentPage = [NOT SURE WHAT GOES HERE]
End Sub
I have read somewhere that I can't link directly to the values in a combo box, but I can use the cell link? If so, how do I do that?
Thanks in advance....
Hi,
Take a look at Debra's solution ...
http://www.contextures.com/xlPivot03.html#ShowItem
Thanks for the prompt response!
But i am not sure what event will trigger the code?
Hi,
I do not know which Excel version you are using ...
But a standard solution is ...
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
But since you are using a data validation cell, you need to hide somewhere a cell = datavalidationcell ...
Thanks. I got it to work but it isn't quite what I am after?
I would like something simpler like this example with images:
http://www.mcgimpsey.com/excel/lookuppics.html
With pictures, one can play with the Visible property ...
But pivot tables are different animals ...
Why don't you upload a zipped copy of your workbook, I can probably fix it for you ...
Thanks Carim...I've uploaded it...
Last edited by anoushka; 02-08-2007 at 11:38 AM.
Sorry ... but your file has a strange extension which prevents me from opening it ...
Sorry - am using office 2007 and im still getting used to it.
Try this?
Because of Excel 2007, had to start from scratch ...
Thanks so much carim!
It worked perfectly at home in excel 2000...but it has an error in excel 2007 :S
It stops at this line
myField.CurrentPage = myFieldItem
and says
"Unable to get the CurrentPage property of the PivotTable"
Any ideas?
Perhaps this error message helps:
"object variable or with block variable not set"
Glad it partially fixed your problem ...
Unfortunately I do not know Excel 2007 ...
Most probably, searching within VBA help ( under pivot table object ) would give the answer, which should the new name of "CurrentPage" under Excel 2007 ...
Thanks for the feedback
ok ive worked it out and i can get it to work but for some reason as soon as it gets to this line
myField.CurrentPage = myFieldItem
executes and then goes back to the start
Private Sub Worksheet_Change(ByVal Target As Range)
and totally skips the loop..
so its ends up in an infinite cycle and i dont know why....
oh i know why!
because when its changing the first pivot table its causing a "worksheet change" which triggers the function to execute all over again...
any idea on what i should change the trigger to?
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks