PC Review


Reply
Thread Tools Rate Thread

Combo box properties in VBA

 
 
=?Utf-8?B?QmVu?=
Guest
Posts: n/a
 
      2nd Nov 2006
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
 
Reply With Quote
 
 
 
 
Andy Pope
Guest
Posts: n/a
 
      2nd Nov 2006
Hi,

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

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

Cheers
Andy

Ben wrote:
> 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


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
 
Reply With Quote
 
=?Utf-8?B?QmVu?=
Guest
Posts: n/a
 
      2nd Nov 2006
Thank you that does the trick.

"Andy Pope" wrote:

> Hi,
>
> To refresh the list, change control and range reference to suit.
>
> Activesheet.OLEObjects("Combobox1").listfillrange="MyList"
>
> Cheers
> Andy
>
> Ben wrote:
> > 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

>
> --
>
> Andy Pope, Microsoft MVP - Excel
> http://www.andypope.info
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to access combo box properties of DataGridView combo column Steve Marshall Microsoft Dot NET Framework Forms 2 26th Jun 2007 01:56 PM
Combo Box Properties Dan Microsoft Excel Programming 1 2nd Nov 2006 03:14 AM
Combo Box Properties =?Utf-8?B?QWxleGFuZHJhNTA0?= Microsoft Access Form Coding 3 28th Sep 2006 02:36 PM
Combo Box Properties =?Utf-8?B?QWV4IGRlIFNpbHZh?= Microsoft Excel Worksheet Functions 1 28th Dec 2005 10:38 PM
Combo Box Properties =?Utf-8?B?Q0s=?= Microsoft Access Forms 1 1st Oct 2004 09:47 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:49 PM.