Hi Community,
I have a field for users to search for an employee in Cell "B24". What I want to happen is that when a user types in the name of an employee and clicks the 'Enter' button on the keyboard to save what was entered that my sub will run a VLookup or match function to return a row of data for the corresponding Employee from my "Data" sheet. Additionally, I need the vLookup or Match function to return each Column value (A2:X2) from the data sheet for the corresponding employee. and display it on the ActiveSheet starting at Range("A30"). MY code is below and any help would be appreciated:
I have a field for users to search for an employee in Cell "B24". What I want to happen is that when a user types in the name of an employee and clicks the 'Enter' button on the keyboard to save what was entered that my sub will run a VLookup or match function to return a row of data for the corresponding Employee from my "Data" sheet. Additionally, I need the vLookup or Match function to return each Column value (A2:X2) from the data sheet for the corresponding employee. and display it on the ActiveSheet starting at Range("A30"). MY code is below and any help would be appreciated:
Code:
Public Sub Auto_GetData()
Dim DataVal As String
DataVal = Range("B24")
' DataDisplay = Range("A30:X30")
DataOut = Application.WorksheetFunction.VLookup(DataVal, Worksheets("Data").Range("A2:X54"), 1 + 1, False)
Range("A30") = DataOut
End Sub
Last edited: