![]() |
If drop down list is blank, return error
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 |
If drop down list is blank, return error
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 |
If drop down list is blank, return error
On Mar 14, 6:06 pm, "merjet" wrote: 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. |
All times are GMT +1. The time now is 05:33 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com