Adding items to a Combo Box

Testested 61 Reputation points
2022-10-30T01:12:10.907+00:00

I am very new with VBA... How should a add items to a combo box using codes?

Developer technologies Visual Basic for Applications
{count} votes

1 answer

Sort by: Most helpful
  1. Oskar Shon 866 Reputation points
    2022-11-08T19:32:22.587+00:00

    Depend of where you want to add this ActiveX object. On sheet

    258403-xl-combo-laczenie-zwrot-danych-z-listy.png

    or in VBA form as control

    258330-xl-combobox-sugerowanie.png

    That is collection so 4 example in form as a loop from range:

    Private Sub UserForm_Initialize()   
    Dim x As Integer  
    ComboBox1.Style = fmStyleDropDownList  
    For x = 1 To 7   
     ComboBox1.AddItem Cells(x, "a")   
    Next   
    ComboBox1.ListIndex = 0  
    End Sub  
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.