Hi,
I'm having at least one issue with this script below. Maybe more...the script is suppose look in Range A3:A100 for the last name that was just entered. if it finds the same name it then needs to look in Range B3:B100 at the first name, if both match a name that is already there then the cells are cleared and the user is asked to try again.
What I found out so far is that cell that the data is entered on is always going to be in the list so it will always find a duplicate.
I need a way to see if the name is listed more than once.
Can someone advise?
Thank You, Mike
Sub DoubleCheck()
Stop
Dim A, B As String
Dim R, R2, AA, BB As Range
Dim Cell, Cell2 As Object
A = Range("A100").End(xlUp).Value: AA = Range("A100").End(xlUp).Address
B = Range("B100").End(xlUp).Value: BB = Range("B100").End(xlUp).Address
Set R = Range("A3:A100")
Set R2 = Range("B3:B100")
For Each Cell In R: Cell.Select ' REMOVE SELECT AFTER TEST
If A = Cell.Value Then
For Each Cell2 In R2: Cell2.Select 'REMOVE SELECT
If B = Cell2.Value Then
MsgBox (Cell2.Value & B)
MsgBox ("That Name Already Exists !!! Please Try Again..."), vbCritical, "Name Exists"
Range(AA, BB).ClearContents
Call LastName
End If
Next Cell2
End If
Next Cell
End Sub
Bookmarks