Consulting

Results 1 to 9 of 9

Thread: List Box

  1. #1

    List Box

    I am trying to add an active x list box to my spreadsheet. I have added the box, but I can't figure out how to add the text that I want to appear in the list. I want to be able to select yes or no from the drop down.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by dmg7502
    I am trying to add an active x list box to my spreadsheet. I have added the box, but I can't figure out how to add the text that I want to appear in the list. I want to be able to select yes or no from the drop down.
    You can set the ListFillRange property to cells on the worksheet, or use code like

    [vba]
    With Activesheet.Listbox1
    .AddItem "Yes"
    .AddItem "No"
    End With
    [/vba]

    But with just two options why not use a checkbox?

  3. #3
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    Or you could use Data | Validation (List), for an in-cell drop down box.

  4. #4
    VBAX Expert
    Joined
    Jul 2004
    Location
    Wilmington, DE
    Posts
    600
    Location
    One simple way: enter Yes and No in a range, and then use that range to define the controls ListFillRange property.

  5. #5
    VBAX Expert
    Joined
    Jul 2004
    Location
    Wilmington, DE
    Posts
    600
    Location
    Quote Originally Posted by firefytr
    Or you could use Data | Validation (List), for an in-cell drop down box.
    Overall, I use this approach probably 90% of the time. It's probably just me, but I do not like using ActiveX controls on worksheets

  6. #6
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    You're not alone there Patrick!

  7. #7
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by firefytr
    You're not alone there Patrick!
    Why? They are the only flexible worksheet controls.

  8. #8
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    I find them cumbersome, overtly expensive in terms of spreadsheet design and elegance, difficult for users to create/use, don't work on Mac solutions, and I think (generally and usually) the process can be performed on the worksheet more effectively without the controls. Not to mention the past bugs they have had (there are still a lot of older versions without updates out there).

  9. #9
    VBAX Expert
    Joined
    Jul 2004
    Location
    Wilmington, DE
    Posts
    600
    Location
    Quote Originally Posted by xld
    Why? They are the only flexible worksheet controls.
    Allow me to clarify--I do not like any worksheet controls.

    If I need controls, I'd rather use a UserForm, which has much, much, much greater flexibility.

Posting Permissions

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