Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: Forms: Listbox question

  1. #1
    New Member
    Join Date
    Mar 2002
    Posts
    38
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I'm trying to design a form. What I would like to do is have 2 option buttons and a listbox. I want to populate the listbox based upon which option button is selected. If they choose option 1, I want to show one set of data in the listbox, but if they choose option 2, I want to show a different set of data.

    Can someone get me started on how to accomplish this?

    Thanks in advance for any help.

  2. #2
    MrExcel MVP Damon Ostrander's Avatar
    Join Date
    Feb 2002
    Location
    Denver, Colorado USA
    Posts
    4,239
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi teebruin,

    Assuming that you want to fill your listbox from two different worksheet ranges, you can simply use the optionbuttons' click events to reassign the RowSource property of the Listbox:

    Private Sub OptionButton1_Click()
    ListBox1.RowSource = "a1:a10"
    End Sub

    Private Sub OptionButton2_Click()
    ListBox1.RowSource = "b1:b10"
    End Sub
    Keep Excelling.

    Damon

    VBAexpert Excel Consulting
    LinkedIn Profile http://www.linkedin.com/pub/damon-ostrander/7/79/a93
    AllExperts Profile http://www.allexperts.com/ep/1059-30...-Ostrander.htm

  3. #3
    New Member
    Join Date
    Mar 2002
    Posts
    38
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thank you very much. This is exactly what I was looking for. I was focused on doing something to the listbox, and didn't even think about the option buttons.

    Again, thanks.

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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