ComboBox drop-down not clearing out old values

BakerUK

New Member
Joined
Nov 19, 2015
Messages
28
Hi,

On my Workbook Open code I first clear the combo values then loop through all the pivot items in a pivot field to generate the new list (this is after pivot has refreshed, so items can vary each time).

However, some old values are still showing up which no longer exist in the pivot. The pivot table is linked to an Access query.

Can anyone help me to remove the old values?

Thanks

Baker
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Sektor

Well-known Member
Joined
May 6, 2011
Messages
2,834
Did you clear combobox before filling it with values?
Code:
ComboBox1.Clear
 

BakerUK

New Member
Joined
Nov 19, 2015
Messages
28
Did you clear combobox before filling it with values?
Code:
ComboBox1.Clear

Yes, it clears beforehand. I've stopped the code at that point and the drop-down is blank. It then loops through the pivot table items and the old values are included.

The old values are definitely not in the query anymore, but must somehow still be saved in the pivot items?? I could probably delete the pivot table and re-build it but this is an automated weekly report so I don't want the manual step.

Thanks for any help on this one.
 

Sektor

Well-known Member
Joined
May 6, 2011
Messages
2,834
Well, when you run your code step-by-step (F8), couldn't you verify, which values go to combobox?
 

BakerUK

New Member
Joined
Nov 19, 2015
Messages
28

ADVERTISEMENT

Well, when you run your code step-by-step (F8), couldn't you verify, which values go to combobox?

Fair point, I've just done that and stepping through I can see that these old values are still PivotItems in my PivotField but I don't know what to do to prevent it? When I go to the pivot table itself, and drop-down the field in question, the old values are not showing there. But when the code runs they are.
 

Watch MrExcel Video

Forum statistics

Threads
1,132,803
Messages
5,655,391
Members
418,195
Latest member
LabraLime

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top