May be this,,,?
Private Sub Worksheet_Change(ByVal Target As Range)
Dim EvalRange As Range
Set EvalRange = Range("a4:a10000")
If Intersect(Target, EvalRange) Is Nothing Then Exit Sub
If Target.Cells.Count > 1 Then Exit Sub
If Target.Value = "" Then Exit Sub
Target.NumberFormat = "0000"
If WorksheetFunction.CountIf(EvalRange, Target.Value) > 1 Then
MsgBox Target.Value & " has already been used." & vbCr & "Do you want to use the same number (cancel) or enter a new one (retry)?", vbInformation, "Value Already Exist"
Application.EnableEvents = False
Target.Value = ""
Application.EnableEvents = True
End If
End Sub
Bookmarks