Ethan
07-06-2011, 11:48 PM
Hello all,
I use the following code to fill a Combobox with data stored somewhere else.
It works fine but I like to be able to fill in a value that isn't in the list already.
Do you guys have an idea?
Private Sub UserForm_Initialize()
Dim I As Range
Dim ws As Worksheet
Set ws = Worksheets("Data")
For Each I In ws.Range("Data")
Me.ComboBox1.AddItem I.Value
Next I
End Sub
Private Sub ComboBox1_Change()
If ComboBox1.ListIndex > -1 Then
Exit Sub
Else
MsgBox ComboBox1 & " Not Found"
End If
End Sub
I use the following code to fill a Combobox with data stored somewhere else.
It works fine but I like to be able to fill in a value that isn't in the list already.
Do you guys have an idea?
Private Sub UserForm_Initialize()
Dim I As Range
Dim ws As Worksheet
Set ws = Worksheets("Data")
For Each I In ws.Range("Data")
Me.ComboBox1.AddItem I.Value
Next I
End Sub
Private Sub ComboBox1_Change()
If ComboBox1.ListIndex > -1 Then
Exit Sub
Else
MsgBox ComboBox1 & " Not Found"
End If
End Sub