In this below macro i want to show in second msgbox you have entered the mobile number is already exists in cell B4
If I type same mobile number in column B cell range then it will show me above message
If I type same mobile number in column B cell range then it will show me above message
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim answer As Integer
If Not Intersect(Target, Range("B:B")) Is Nothing Then
On Error Resume Next
If Len(Target.Cells) > 10 Or Len(Target.Cells) < 10 Then MsgBox _
"Please check the number you have Enter The Mobile should be contain 10 Digits only"
If Application.CountIf(Columns(2), Target.Cells.Value) > 1 Then
answer = MsgBox("You have Entered the Mobile Number is Already Exist in cell" _
& vbNewLine & "If you want to continue with Duplicate Mobile Number click (YES)" _
& vbNewLine & "If want to remove Duplicate Mobile Number in EnireRow click (NO)", _
vbQuestion + vbYesNo + vbDefaultButton2, "Duplicate Entry")
If answer = vbNo Then
Target.Cells.EntireRow.Delete
End If
End If
End If
End Sub