populate combobox in VBA with array elements

前端 未结 2 557
慢半拍i
慢半拍i 2021-01-13 14:56

I have a VBA procedure (in Excel 2007) where I aspire to set the ListFillRange property of a combobox styled as a list using an array.

I know this works if I right c

相关标签:
2条回答
  • 2021-01-13 15:30

    The only way you can populate a combobox with the content of an array is by doing it element by element. I find it hard to believe that it would be a notably slow process no matter how large your array is.

    0 讨论(0)
  • 2021-01-13 15:32

    I know its late but maybe it is going to help someone else. At least the following code works (much faster than element for element) for me.

    dim arr() as variant
    
    arr = Worksheets("Total").Range("C2:"&lrow).Value
    Worksheets("Menu").ComboBox2.List = arr
    
    0 讨论(0)
提交回复
热议问题