Listbox.additems passing a range

In the file titled “Useful Macro Information”, Mr. Andrew Pitonyak states that instead of adding items to a listbox or combo box individually, one can use addItems method, which eventually adds an entire one dimensional array. (Section 10.2.5)

Syntax: oControl.addItems(Array(“Item1”, “Item2”, “Item3”),0)

When one copies a range to an array, using range.getDataArray, the method returns a two dimensional array:

Item1(0)(0)
Item2(1)(0)
Item3(2)(0)

Aside for converting the two dimensional array to a one dimensional array, is there an easier method of passing the array to the oControl.addItems method?

Are you now asking about a listbox or combo box that sits right on a spreadsheet sheet? In this case, please look at the property “Source cell range” (it’s on the Data tab). If we are talking about a custom dialog, then it’s easier to use adding items to a listbox or combo box individually (IMHO)

I was asking about a custom dialog. I noticed that a form that sits right on the spreadsheet has that option, but not a predefined dialog. Nevertheless, a quick array conversion resolved the problem:

for i = 0 to oRangeAddress.endRow - oRangeAddress.startRow
	vList(i) = vListRange(i)(0)
next i