So my code was made to select any row where the entered name will be present in the active worksheet. Rather than typing the names one by one in the message box, I was wondering if it could do the same function with multiple names in another tab called 'Leaving Staff' in Column A (range A2 to A100).
Here is my code:
Sub Leaving_Employee()
Dim Rng As Range
Dim myCell As Object
Dim myUnion As Range
Set Rng = ActiveSheet.Range("A2:AN50000")
searchString = InputBox("Welcome! Please Enter the Full Name")
For Each myCell In Rng
If InStr(myCell.Text, searchString) Then
If Not myUnion Is Nothing Then
Set myUnion = Union(myUnion, myCell.EntireRow)
Else
Set myUnion = myCell.EntireRow
End If
End If
Next
If myUnion Is Nothing Then
MsgBox "The employee was not found in the selection"
Else
myUnion.Select
End If
End Sub