Thread: Data Validation
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default Data Validation

Powlaz wrote:
Frank,
Thanks for the help. I like the solution, although I am
curious about automating the process. Do you have any
tips or a suggestion on how to do so?

Matt

Hi Matt
some ideas (just a little bit late for me to do the coding for this in
total, but you may get some ideas)
- In cell B4 use a normal data validation with a list for your allowed
values, validation for the other cells remain the same
- now to check for an entry in B4 AFTER the other cells have been
entered: one way would be to use the worksheet_change event. some
example code (not fully tested nor streamlined)

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("B4")) Is Nothing Then Exit Sub '
Only cell B4 is checked
On Error GoTo CleanUp:
If Target.Offset(0,1)<"" or Target.Offset(0,2)<"" or
Target.Offset(0,3)<"" then
msgbox "Values will be cleared"
Application.EnableEvents = False
Range("C4:E4").value = ""
end if
CleanUp:
Application.EnableEvents = True
End Sub

Frank