Hello,
I am sure this is an easy fix, but I have been searching everywhere and have yet to find anything.
I have one column with employee names (Column L) and and another column with employee ID numbers (Column M)
I need a macro that when the Employee ID number is searched it returns the Employees Name.
I really dont want a function. I am looking for a macro
Thanks
-Kyle
------L----------------------M
Employee 1 ----------- 1
Employee 2------------ 2
Employee 3 ------------3
Employee 4 ------------4
Employee 5 ----------- 5
Employee 6 ----------- 6
Employee 7-------------7
Employee 8 ----------- 8
End Sub
Last edited by Crebsington; 08-21-2011 at 02:56 AM. Reason: Format
How will the Employee ID number be searched?
Hi Crebsingtion,
Try the following code and let me know if it meets your requirementsSub Crebsington() Dim SrchString As String Dim FoundRng As Range, oCell As Range Dim Ws1 As Worksheet Set Ws1 = Worksheets("Sheet1") SrchString = InputBox("Enter the employee number", "") If SrchString = "" Then Exit Sub Set FoundRng = Ws1.Range(Ws1.Cells(2, 13), Ws1.Cells(Rows.Count, 13).End(xlUp)).Cells.Find(SrchString) If Not FoundRng Is Nothing Then MsgBox "Employee No: " & SrchString & vbNewLine & "Employee Name: " & FoundRng.Offset(0, -1).Value End If End Sub
Please leave a message after the beep!
Yes This is Perfect!
Last edited by Crebsington; 08-21-2011 at 02:55 AM. Reason: Solved
Thank you!!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks