View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
K Dales[_2_] K Dales[_2_] is offline
external usenet poster
 
Posts: 1,163
Default Combobox with a dynamic list

You don't even need the select case he as long as you ensure only valid
items (e.g. Worksheet names) are in the combobox you can just do this:

Private Sub ComboBox1_Change()
Worksheets(ComboBox1.Text).ShowDataForm

--
- K Dales


"Arishy" wrote:

I created a combobox that accepts a dynamic list. The problem is:
when I program the Case code for the event Combobox_change I am faced
with the missing code for the new cases ( added items in the dynamic
list )

Let me expand:

Private Sub ComboBox1_Change()
Select Case ComboBox1.Text
Case ("item1")
Worksheets("item1").ShowDataForm
Case ("item2")
Worksheets("item2").ShowDataForm
Case Else
End Select

Now I have the new "item3" in the combobox but no code to execute the
selection

The needed code is:

case ("item3")
Worksheets("item3").ShowDataForm

How can I can PROGRAM adding these lines to my CASE section ????

You help will be greatly appreciated ...as allways