Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default 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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
drop down list shows first blank row after last list entry Jerry Bennett[_2_] Excel Discussion (Misc queries) 1 November 10th 07 11:35 AM
drop down list starts from blank row Jerry Bennett Excel Discussion (Misc queries) 5 November 9th 07 09:05 PM
Drop Down List Ignore Blank Ben Dummar Excel Discussion (Misc queries) 1 September 22nd 06 07:53 PM
Ignoring Blank value in a drop down list shail Excel Worksheet Functions 15 August 28th 06 12:39 PM
Drop down list to return row number? infojmac Excel Discussion (Misc queries) 4 May 22nd 06 10:06 PM


All times are GMT +1. The time now is 12:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"