Evalulate previous cell
I didn't test this but it should work. If not post back.
Private Sub Worksheet_Change(ByVal Target As Range)
resRng = Range("A1:A6")
If Target = Intersect(Target, resRng) Then
If Target.Value = A1234 Or Target.Value = A5678 _
Or Target.Value = B9999 Then
goBack = MsgBox("You cannot use a reserved number." _
,vbInformation, "TRY AGAIN")
Target.Value = ""
End If
End If
End Sub
"LaDdIe" wrote:
Hi all,
How can I Eval cell value before allowing the user to move to the next cell.
I.E.
In A1:A6 the user enters a 5-6 Digit reference code (Mixure of
Text&Number), if one of my reserved codes is used (I.E. A1234 or A5678 or
B9999) then a warning pop-up and not allow the user to move to the next cell
on the right.
Either some solution as a formula or VBA will be fine.
Thanks
Laddie.
|