How to add items to a combobox in a form in excel VBA?

前端 未结 3 1019
春和景丽
春和景丽 2020-11-28 15:55

I am new to VBA. I want to create a form where a user selects an item of a combobox and the selection runs a macro.I created a user form in VBA but I am unable to add items

3条回答
  •  隐瞒了意图╮
    2020-11-28 16:19

    The method I prefer assigns an array of data to the combobox. Click on the body of your userform and change the "Click" event to "Initialize". Now the combobox will fill upon the initializing of the userform. I hope this helps.

    Sub UserForm_Initialize()
      ComboBox1.List = Array("1001", "1002", "1003", "1004", "1005", "1006", "1007", "1008", "1009", "1010")
    End Sub
    

提交回复
热议问题