I'm trying to do two comboboxes that are used to change pivot table fields.
And here are the variables for the comboxes:Private Sub ComboBox1_Change() Dim pt As PivotTable Dim pf As PivotField Dim cb As ComboBox Set pt = Sheets("SELECTION").PivotTables("PivotTable2") Set pf = pt.PivotFields("FY") Set cb = RemoteControl.ComboBox1 pf.CurrentPage = cb.Value End Sub Private Sub ComboBox2_Change() Dim pt As PivotTable Dim pf As PivotField Dim cb As ComboBox Set pt = Sheets("SELECTION").PivotTables("PivotTable2") Set pf = pt.PivotFields("Select Actuality") Set cb = RemoteControl.ComboBox2 pf.CurrentPage = cb.Value End Sub
The problem is that if choose value 2010 or 2011 in combobox1, i get an error "Run-time error 5: Invalid procedure call or argument". Strange thing is that combobox2 is working perfectly, and combobox1 is working if i select value 2012.With RemoteControl.ComboBox2 .AddItem "AF" .AddItem "GF" .AddItem "F1" .AddItem "F2" .AddItem "F3" .AddItem "F4" .AddItem "F5" .AddItem "F6" End With With RemoteControl.ComboBox1 .AddItem "2010" .AddItem "2011" .AddItem "2012" End With
I'm totally confused and have searched for the answer all over, so I would really appreciate if someone could help me!
Br,
Teemu
Last edited by Teemu; 07-13-2011 at 01:51 PM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks