How do I require data entry in a combo box in Excel?

N

noviceql

I'd like to require a selection from a combo box in a form in Excel before
the form is saved. (Also with a msg box)

What's the best way to do this?

Thanks
 
R

royUK

Place this code in your save button, make sure the control names matc
yours


Code
-------------------
Option Explicit

Private Sub CommandButton1_Click()
With Me
If .ComboBox1.ListIndex - 0 Then
MsgBox "You must select from the dropdown list", vbCritical, "Input required"
.ComboBox1.SetFocus
Exit Sub
Else: 'your save code here
End If
End With
End Su
-------------------

--
royU

Hope that helps, RoyUK
For tips & examples visit my 'web site
' (http://www.excel-it.com
 
Top