I have copied this macro and applied it to my sheet but I only want it to prevent duplicates in column C
not being well versed in macros I'm not sure what to change
this code prevents duplicates in all columns
not being well versed in macros I'm not sure what to change
PHP:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If IsEmpty(Target.Value) Then Exit Sub
If Target.Count > 1 Then Exit Sub
If Target.Column < 2 Then Exit Sub
With Range(Cells(1, Target.Column).Address & ":" & Cells(Target.Row - 1, Target.Column).Address & "," & Cells(Target.Row + 1, Target.Column).Address & ":" & Cells(Rows.Count, Target.Column).Address)
Set c = .Find(Target.Value, , , xlWhole)
If Not c Is Nothing Then
MsgBox "P.O.# has been used: " & c.Address(0, 0)
Target.Value = ""
End If
End With
End Sub
this code prevents duplicates in all columns
Last edited: