![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Mar 2002
Posts: 38
|
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 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Denver, Colorado USA
Posts: 4,014
|
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 (My other life: http://damonostrander.com ) |
|
|
|
|
|
#3 |
|
New Member
Join Date: Mar 2002
Posts: 38
|
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. |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|