F
Freddy
What VB macro code can be used to check for duplicate values AFTER all
entries are made into a column instead of as they are being entered? I am
running Microsoft Visual Basic 6.5 in Office 2002. I found the code below,
written by Ardus Petus, that checks for duplicate values AS THEY ARE ENTERED:
'----------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
'Adjust next constant to your own needs
Const myColumn As String = "B"
Dim rng As Range
Dim Found As Range
Set rng = Columns(myColumn)
If Intersect(Target, rng) Is Nothing Then Exit Sub
Set Found = rng.Find(Target.Value)
If Found.Address <> Target.Address Then MsgBox ("Duplicate code")
End Sub
'-----------------------------------
entries are made into a column instead of as they are being entered? I am
running Microsoft Visual Basic 6.5 in Office 2002. I found the code below,
written by Ardus Petus, that checks for duplicate values AS THEY ARE ENTERED:
'----------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
'Adjust next constant to your own needs
Const myColumn As String = "B"
Dim rng As Range
Dim Found As Range
Set rng = Columns(myColumn)
If Intersect(Target, rng) Is Nothing Then Exit Sub
Set Found = rng.Find(Target.Value)
If Found.Address <> Target.Address Then MsgBox ("Duplicate code")
End Sub
'-----------------------------------