Results 1 to 4 of 4
  1. #1
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    AddItems to Combobox control (Excel 2003 / 2007)

    Hi,

    A few months back, Jezza (I think) posted a reply that contained a way to add items into a User Form combobox control without having to list all the items (one below the other) in the Form_Initialize event. I cannot remember anything about the code, and I seem to be having trouble finding the post. Can anyone remember where to get the post, or can anyone help me with code to populate a combo without having to list all the entries using the additems method.

    TX
    Regards,
    Rudi

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: AddItems to Combobox control (Excel 2003 / 2007)

    You can set the RowSource property of a combo box or list box to a range of a worksheet, either interactively or using code.

    (Perhaps you meant the thread starting at <post:=680,789>post 680,789</post:>?)

  3. #3
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: AddItems to Combobox control (Excel 2003 / 2007)

    Tx for the reply.

    I think I am getting the idea now, as your reply states. I also found another post: <post#=719,861>post 719,861</post#>.

    My own macro (test Hans...its a little tester <img src=/S/grin.gif border=0 alt=grin width=15 height=15>) is also working:

    Private Sub UserForm_Initialize()
    Dim myC As Range
    For Each myC In Range("C7:C15")
    Me.ComboBox1.AddItem myC
    Next myC
    End Sub

    Tx
    Regards,
    Rudi

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: AddItems to Combobox control (Excel 2003 / 2007)

    That should work too. You can also use

    Me.MyCombo1.RowSource = "C7:C15"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •