Hi everyone
the following vba code is working fine to restrict the user from entering duplicate entry in column B but i dont have any idea why it is giving pop up window error as soon as i copy or delete data in other portion of excel as shown in the attached image
Please rectify the code so it does not cause any problem while working on any action performed in other portion of excel.
Thanks
the following vba code is working fine to restrict the user from entering duplicate entry in column B but i dont have any idea why it is giving pop up window error as soon as i copy or delete data in other portion of excel as shown in the attached image
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If WorksheetFunction.CountIf(Range("B:B"), Target) > 1 Then
MsgBox "Duplicate Entry Is Not Allowed", vbCritical, "Duplicate Entry"
Target.Value = ""
Target.Select
End If
End Sub
Please rectify the code so it does not cause any problem while working on any action performed in other portion of excel.
Thanks