Maybe you could try posting a sample workbook so the concept is clearer. I'm confused as to where exactly you are entering the last and first names.
Maybe you could try posting a sample workbook so the concept is clearer. I'm confused as to where exactly you are entering the last and first names.
Hello Mike,
It is easier and faster to use the Dictionary Object. The Dictionary allows you to randomly check if something already exists. Here is an example...
![]()
Sub Check_B() Dim Cell As Range Dim MyName As Variant Dim MyNames As Object Dim Rng As Range Dim RngEnd As Range Set Rng = Range("A3:B3") Set RngEnd = Cells(Rows.Count, Rng.Column).End(xlUp) If RngEnd.Row < Rng.Row Then Exit Sub Else Set Rng = Range(Rng, RngEnd) Set MyNames = CreateObject("Scripting.Dictionary") MyNames.CompareMode = vbTextCompare For Each Cell In Rng.Columns(1).Cells MyName = Cell.Text & " " & Cell.Offset(0, 1).Text If Not MyNames.Exists(MyName) Then MyNames.Add MyName, 0 Else MsgBox "That Name Already Exists !!! Please Try Again...", vbCritical, "Name Exists" Cell.Resize(1, 2).ClearContents Call LastName End If Next Cell Set MyNames = Nothing End Sub
Sincerely,
Leith Ross
Remember To Do the Following....
1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.2. Thank those who have helped you by clicking the Starbelow the post.
3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks