View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mike Jerakis[_2_] Mike Jerakis[_2_] is offline
external usenet poster
 
Posts: 8
Default Data Validation & Worksheet_change

I am trying to use data validation to restrict users to a list of people's
names, which is contained in range somewhere in the file. However, I'd like
the user to enter a different name if they really want to. If they do, I've
got to intercept it, validate it, and then add it into the list for future
reference in the data validation. I've changed the Data Validation to not
create an immediate error alert.

My approach to this was within the Worksheet change event.
Private Sub Worksheet_Change(ByVal Target As Range)
If Not (Intersect(Target, Range("lstLaborInputName")) Is Nothing) Then
If Target.Validation.Value = False Then
'code to validate and add to valid to list
End If
End If
End Sub
Where the first IF statement decides whether the change took place in the
area I want to evaluate.

However, the Target.Validation.Value is always returning true, regardless of
what is entered when I make the change.

Here's the wierd part, though, if I undo what I typed and the cell is still
"invalid", the code triggers. If the undo value is valid, it doesn't, i.e.
the code seems to work fine.

Does using the Data Validation dropdown not trigger a worksheet change
event? I can't find any references to that,

Any ideas?