Custom error-message for MatchRequired ComboBox

G

Gert-Jan

In my userforms I use often ComboBoxes, with the "MatchRequired" option to
"True". Is it possible to customize the error message when someone tries to
select something that is not in the RowSource? Now I see a awfull
Excel-error.
 
G

Gert-Jan

Found it already:

Private Sub ComboBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If ComboBox1.MatchFound = True Then
Exit Sub
Else
MsgBox ComboBox1.Value & " is an invalid entry"
Cancel = True
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top