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

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Sektor

Well-known Member
Joined
May 6, 2011
Messages
2,863
Office Version
  1. 365
Platform
  1. Windows
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,863
Office Version
  1. 365
Platform
  1. Windows
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.
 

Sektor

Well-known Member
Joined
May 6, 2011
Messages
2,863
Office Version
  1. 365
Platform
  1. Windows
You're welcome!
 

Forum statistics

Threads
1,141,858
Messages
5,709,035
Members
421,606
Latest member
Faisel135

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