Combo box properties in VBA

B

Ben

I've created a Combo box from the Control toolbox. In ListFillRange I have
entered a range name rather than specify the cell references. So far so good.
Everything works.
However if I convert that named range to a dynamic range i.e one that
expands as new rows are added to it (using OFFSET and COUNT) the list of
choices that appear in the drop down list become slightly incorrect with one
of the items appearing twice even though it appears only once in the
specified range.
As an alternative I've tried programmatically deleting the range and
recreating it as an expanded range. Unfortunately, in order for this to work
I have to manually open the Combo box and re-insert the range name in the
LIstFillRange even though it is the same name as before. Is there a way of
using code to emulate the process of opening the combo box and re-entering a
name in the ListFillRange field.
Thank you
 
A

Andy Pope

Hi,

To refresh the list, change control and range reference to suit.

Activesheet.OLEObjects("Combobox1").listfillrange="MyList"

Cheers
Andy
 
B

Ben

Thank you that does the trick.

Andy Pope said:
Hi,

To refresh the list, change control and range reference to suit.

Activesheet.OLEObjects("Combobox1").listfillrange="MyList"

Cheers
Andy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top