I am trying to find the first and last names of people in a cell. I have a userform to get their first and last names separately. I am trying to run a VBA macro to determine if each cell in a column contains both first and last names, and then put a "Y" in an adjacent column. The Code I have is as follows:
Dim Last, i As Long
Last = Cells(Rows.Count, "C").End(xlUp).Row
MsgBox (Employee & " and " & Employee1)
For i = Last To 1 Step -1
If InStr(Cells(i, "C"), Employee) = 1 Then
If InStr(Cells(i, "C"), Employee1) = 1 Then
Cells(i, 6).Select
If ActiveCell.Value = "Y" Then
Application.ScreenUpdating = True
Call Message1
ElseIf ActiveCell.Value = "" Then
ActiveCell.Value = "Y"
Call Message3
End If
End If
End If
Next
With just one InStr statement, it finds the first name just fine, but it isn't the right person, because there is more than one person with that first name. the second InStr won't allow it to find anything. I know I'm missing something simple, and would appreciate any help you can provide.
Bookmarks