If drop down list is blank, return error

S

sbweld

Hello,

I am using a data validation list, if the user types in something
other than what is available on the list an error pops up and advises
the user to select from the drop down list. However, if the user goes
to the field containing the drop down list and hits delete, the blank
space is considered valid (why is this?). Is there a way to alert the
user and bring them back to the drop down list if it is left blank?
Each of the lists have default selections (which are not blank).

Thanks!

Sean
 
M

merjet

You could force a default value with VBA. Suppose the cell with
validation is C1 and the default is 1. Put this code in the sheet's
code module.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$C$1" Then
If IsEmpty(Target) Then Target = 3
End If
End Sub

Hth,
Merjet
 
S

sbweld

You could force a default value with VBA. Suppose the cell with
validation is C1 and the default is 1. Put this code in the sheet's
code module.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$C$1" Then
If IsEmpty(Target) Then Target = 3
End If
End Sub

Hth,
Merjet

Magnificent, works like a charm. Thanks a lot Merjet.
 

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