Hello bdouglas1011
This was tricky but I got it to work. The macro below has been added to the attached workbook.
Sheet "Daily Chgs" - Worksheet_Change() Event Code
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim Match As Range
Dim Rng As Range
Dim RngBeg As Range
Dim RngEnd As Range
Dim x As String
If Not Intersect(Target, Range("B:B")) Is Nothing Then
With Application.FindFormat
.Clear
.Interior.Color = RGB(240, 213, 212)
End With
Set Rng = Range("B9:B67").Resize(ColumnSize:=5)
Set RngBeg = Rng.Find("", Target, xlValues, xlWhole, xlByRows, xlPrevious, False, False, True)
If Not RngBeg Is Nothing Then
Set RngEnd = Rng.Find("", Target, xlValues, xlWhole, xlByRows, xlNext, False, False, True)
Set Rng = Range(RngBeg.Offset(1, 0), RngEnd.Offset(-1, 0)).Resize(ColumnSize:=5)
Set Match = Rng.Find(Target.Value, , xlValues, xlWhole, xlByRows, xlNext, False, False, False)
If Not Match Is Nothing Then
x = Match.Address
Set Match = Rng.FindNext(Match)
If Not Match Is Nothing Then
If Match.Address = x Then Exit Sub
Application.EnableEvents = False
Target.Value = Empty
Target.Select
MsgBox "Please make another selection. Duplicates are not allowed."
Application.EnableEvents = True
End If
End If
End If
End If
Application.FindFormat.Clear
End Sub
P.S. The password for "Daily Chgs" is Financial3. I found a reference in your code.
Bookmarks