Search code examples
excelvbacomboboxnamed

How to use Named Array Constant to fill an Active-X ComboBox in Excel


I'd like to setup my ComboBox values as a named array constant, where you go into the Name Manager and define a name and give it a value like:

={"A", "B", "C"}

I've found that ListFillRange will only take a Range so I can't assign to that.

Though it would work for a normal named range, like so:

myComboBox.ListFillRange = "MyList"

So how do you assign a Named Array Constant to fill a ComboBox?


Solution

  • After much searching I found this solution:

    myComboBox.List() = Evaluate(ThisWorkbook.Names("MyList").RefersTo)