Hello Kim_J,
Here is the code to restrict the user's input to the list in your ComboBox. The example uses a UserForm, a ComboBox, and a CommandButton. You can change the names and the loading of the ComboBox to match your needs. The code disables the user from using the Close Box on the title bar. You must close your form using a Command Button.
Private Sub CommandButton1_Click()
'CLOSE THE FORM
Unload Me
End Sub
Private Sub UserForm_Activate()
'VALIDATE THE ENTRY
'The user's entry must match what is in the list
'before can be passed to another object on the form.
ComboBox1.MatchRequired = True
'Load some data into the ComboBox
ComboBox1.List = Array("Apples", "Grapes", "Kiwi", "Oranges", "Persimmons")
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
'DISABLE THE CLOSE BOX
If CloseMode = 0 Then Cancel = True
End Sub
Sincerely,
Leith Ross
Bookmarks