![]() |
Options and Combo Boxes
I have two options in my data sheet. When the first option is clicked on, I
want a combobox to appear. When the second option is clicked on, I want a different combobox to appear in the same location as the first. I am having trouble writing the code for this. I would greatly appreciate it if someone could help me with this. |
Options and Combo Boxes
Think laterally: use the same combo box but repopulate it when the
option is clicked. mtm4300 wrote: When the second option is clicked on, I want a different combobox to appear in the same location as the first. You can populate a combo box by setting it's .List property to an array variable (or it's .Column property, if the array is inconveniently-directed) Private Sub optFoo_Click() Dim arrList as Variant Dim iRow as Integer If Me.optFoo.Value=True Then 'Code to redimension and populate an array from source 1 arrList = ThisWorkbook.Names!myName.RefersToRange.Value Else 'Code to redimension and populate an array from source 2 Redim arrList(0 to 6, 0 to 1) ' List property is a zero-based array For iRow = 0 to 6 arrList(irow, 0) = Chr(64+ iRow) arrList(irow, 1) = iRow Next iRow Else Me.cboFoo2.Clear Me.cboFoo2.List = arrList Erase arrList End If |
All times are GMT +1. The time now is 05:25 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com