Adding Items To A Combo Box Without Code?

18,719

Solution 1

If I understand you question correctly, I'm fairly sure you have to have code somewhere, I don't think VBA supports as I seem to remember that VB6 did to just add the items in a property, but you don't have to create a separate module, just something like this should work:

Private Sub UserForm_Activate()
    ComboBox1.AddItem "Text1"
    ComboBox1.AddItem "Text2"
    ComboBox1.AddItem "Text3"
End Sub

Solution 2

What program are you using? Where is the combobox. For example, in Excel, you can have a combobox on a form or on the worksheet, and the answer is going to depend on these factors.

In Excel, you can define your default values in a worksheet (which you can hide, if you want), and set the combo box source to the corresponding range -- no code required.

Please elaborate on your requirements and you'll get more specific answers.

Solution 3

I guess you speak about Access ? If that's the case,

  • set the Row Source Type to "Value List"
  • then set the Row Source to Black; Blue; Green or whatever you want
Share:
18,719
sooprise
Author by

sooprise

I like to program, but am a noob, which is why I'm here. <-My sexy fatbooth picture

Updated on June 04, 2022

Comments

  • sooprise
    sooprise almost 2 years

    I want some default values in my combo boxes but can't seem to figure out how to do this without writing a module that populates the combo boxes. How can I manually fill in the combo boxes so I don't have to use code to do something so simple.

    Thanks