VBA: fill combobox from a column

Solved
alena20 Posted messages 24 Status Member -  
alena20 Posted messages 24 Status Member -
Hello,

I want to fill the combo box in the userform from a column and I am using this code

 Private Sub UserForm_Initialize() Dim i As Long For i = 2 To 20 ComboBox1.AddItem Sheets("ListOfParameters").Cells(i, 1) Next i UserForm1.Show End Sub 


There is an 'Object required' error that appears, I don't understand the cause of this error

Thank you for your help
Best,
Alena
Configuration: Windows 7 / Internet Explorer 9.0

6 answers

  1. eriiic Posted messages 24581 Registration date   Status Contributor Last intervention   7 281
     
    Hello,

    or:
    Private Sub UserForm_Initialize() ComboBox1.List = worksheets("Sheet1").Range("A2:A20").Value End Sub

    eric

    --
    You will never respond to an unsolicited DM...
    Well, that's done.
    11