Home » excel » excel – VBA store string instead of range in ListFillRange ActiveX ComboBox

excel – VBA store string instead of range in ListFillRange ActiveX ComboBox

Posted by: admin April 23, 2020 Leave a comment

Questions:

I’ve researched but been unable to find if it is possible to store a string instead of a Range in the ActiveX ComboBox.

My workbook has so many dependency’s that it recalculates ComboBox(s) etc whenever the user enters any type of formula. I’ve pasted values in the underlying formula-based range which helps and turned off calculation to no avail. Any guidance is appreciated.

Update – the combobox is bound and this is an example of setting the range.

ThisWorkbook.Worksheets("Securities").OLEObjects("cboList").ListFillRange = "Securities!" & Range("mySecurities").Address
How to&Answers:

Use the AddItem method of the ControlFormat property:

With Sheet1.Shapes("ComboBox1").ControlFormat
    .AddItem "Sunday"
    .AddItem "Monday"
    .AddItem "Tuesday"
End With