Unusual Use for Data Validation?

  • Thread starter Thread starter MLT
  • Start date Start date
M

MLT

I'm trying to figure out if this is possible: In column A are dates,
in column B are priority values (High, Med, or Low). If, in a row,
the priority is listed as High or Med, then that row must have a date
(or column A in that row must not be blank). Could this be done with
a custom data validation?
 
Rght click sheet tab>view code>insert this
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Or Target.Column <> 2 Then Exit Sub
If LCase(Target) = "high" Or LCase(Target) = "med" Then
If IsDate(Cells(Target.Row, 1)) = False Then _
MsgBox "Enter a date in col A"
End If
End Sub
 
Back
Top