ComboBox Help

at148
07-13-2010, 11:38 AM
Hello there,

If anyone can help would be of great-great-great help!

I am trying to make a combo-box to have a drop down list of two or more objects as constant texts, under of each choice a function runs.

The problem is that the Items don't show on the combo at the userform and of course I have a miss-match on values.

Here is my code:


Private Sub ComboBox1_Change()

End Sub

Private Sub CommandButton1_Click()
UserForm1.Hide
If UserForm1.ComboBox1.ListIndex = "Example" Then
Call EnterData
End If
If UserForm1.ComboBox1.ListIndex = "Enter Data" Then
MsgBox "Give the Data"
End If
End Sub

Private Sub CommandButton2_Click()
UserForm1.Unload
End Sub

Private Sub UserForm1_Activate()
ComboBox1.AddItem "Example"
ComboBox1.AddItem "Enter data"
End Sub

Public Sub main_Click()
UserForm1.Show
End Sub

Kluz
07-13-2010, 08:13 PM
The help file identifies the ListIndex as a numerical value, not text as you have in your example.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum