+ Reply to Thread
Results 1 to 2 of 2

VBA code to return 2 vlookup values into 1 textbox on userform

  1. #1
    Registered User
    Join Date
    01-13-2006
    Location
    Australia
    Posts
    8

    VBA code to return 2 vlookup values into 1 textbox on userform

    I have a Userform that Collects data for employee Mileage Claims.

    The Employee data is in a worksheet called Employee Data. There is a named Range in that worksheet called EmpCode, which is used in the Vlookup
    Column A is Employee Code
    Column B is Surname
    Column C is firstname

    I have a Combobox that lets you select the Employee Code (CboEmpCode). I want the form to then automatically fill the one textbox (TxtName) with both the Firstname and Surname.

    The following code uses vlookup to return the surname to the textbox but how do I add another vlookup so it returns firstname as well in the same textbox

    Private Sub CboEmpCode_AfterUpdate()
    'Lookup Values based on first Control
    With Me
    .TxtName = Application.WorksheetFunction.VLookup(Me.CboEmpCode, Worksheets("Employee Data").Range("EmpCode"), 2, 0)
    End With
    End Sub



    Look forward to an answer
    With thanks

  2. #2
    Registered User
    Join Date
    02-24-2016
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    92

    Re: VBA code to return 2 vlookup values into 1 textbox on userform

    You can try this:
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Textbox values to match value in textbox 1 on a userform
    By Shellybelly in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-03-2015, 05:29 PM
  2. Userform Macro need minor adjustments to code (Populate Textbox and Combobox Return Issue)
    By jaredmccullough in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-15-2014, 08:07 AM
  3. Userform to search textbox value to place other textbox values in worksheet
    By mattyh555 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-19-2012, 11:38 AM
  4. [SOLVED] VBA UserForm - Have entry in TextBox fill Another TextBox by VLOOKUP
    By msquared99 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-26-2012, 10:24 PM
  5. Use textbox input and VLookup to update another textbox on same userform
    By gcoug in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-22-2011, 10:39 AM
  6. Userform: Pass textbox values to another textbox on button press
    By adjustermn in forum Word Programming / VBA / Macros
    Replies: 3
    Last Post: 02-09-2010, 11:19 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1