I'm only so so with VBA but is this what you are looking for? (see attachment)
code is in worksheet as follows
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("B2:B100")) Is Nothing Then Exit Sub
If Target = "" Then Exit Sub
If Target.Offset(0, -1) = 0 Then
MsgBox ("You must fill in column A first")
Target.ClearContents
End If
If Target.Offset(0, -1) = 4444 And (Target < 3 Or Target > 4) Then
MsgBox ("A" & Target.Row & " is 4444. Value needs to be 3 or 4.")
Target.ClearContents
End If
If Target.Offset(0, -1) <> 4444 And (Target = 3 Or Target = 4) Then
MsgBox ("A" & Target.Row & " is " & Target.Offset(0, -1) & ". Value cannot be 3 or 4.")
Target.ClearContents
End If
End Sub
I used 3 rules
if a = 4444 b has to be 3 or 4
if a is empty then can't fill in b
if a <> 4444 then b cannot be 3 or 4
Bookmarks