+ Reply to Thread
Results 1 to 6 of 6

How can I use a vlookup in a UserForm

  1. #1
    Registered User
    Join Date
    07-17-2014
    Location
    Nashville, TN
    MS-Off Ver
    2010
    Posts
    20

    How can I use a vlookup in a UserForm

    I have created the attached UserForm and I am now attempting to use a Vlookup or VBA code to make filling the form out easier.

    Basically, when the Manager inputs the employees name, I would like it to auto populate the supervisor and employee ID number.

    The above information is currently housed on the Reference Page. I have watched videos, tutorials and researched the web but still can not figure out how to make this happen.

    Please overlook the "REF" column as that was supposed to attach a # to the row but I am going to do something different.

    Thank you in advance for the assistance.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: How can I use a vlookup in a UserForm

    The Name combobox is populated from range A2:A144. When you select a name,it has an index number. The first name in the combobox list is index number 0, the second name is index 1, the third name index 2...etc. You can use the index number of the selected Name as the row number by adding 2 to it. So the first name is index 0. The add 2 to it and you know it is from row 2. Make sense?

    The code below gets the index number of the selected name, adds 2 to it and gets the values from that row from columns B and C for the respective ID and Supervisor.

    Please Login or Register  to view this content.
    Last edited by AlphaFrog; 04-16-2018 at 06:01 PM.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    07-17-2014
    Location
    Nashville, TN
    MS-Off Ver
    2010
    Posts
    20

    Re: How can I use a vlookup in a UserForm

    OMG you are freaking awesome.

    Thank You - Now I will have to review and understand your code.

  4. #4
    Registered User
    Join Date
    07-17-2014
    Location
    Nashville, TN
    MS-Off Ver
    2010
    Posts
    20

    Re: How can I use a vlookup in a UserForm

    So, when I applied the above code, the UserForm stopped looking for next blank row and is just replacing the data in the same row. Where/What am I missing?

  5. #5
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: How can I use a vlookup in a UserForm

    The code I suggested doesn't look for the next blank row or replace anything. I don't know what you're referring to.

  6. #6
    Registered User
    Join Date
    07-17-2014
    Location
    Nashville, TN
    MS-Off Ver
    2010
    Posts
    20

    Re: How can I use a vlookup in a UserForm

    Yea me either apparently. I must have deleted something unaware. I downloaded the version uploaded here, applied your code and it is working correctly. FAT FINGER TUESDAY apparently. Sorry

+ 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. Userform to return vlookup then reference vlookup text
    By BG1983 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-17-2016, 02:09 PM
  2. Userform VLookup
    By Oilfield in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-26-2016, 10:17 AM
  3. VBA Userform Vlookup
    By anthony_91 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-06-2013, 10:17 PM
  4. vlookup with userform
    By apia in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-10-2012, 06:26 AM
  5. VLOOKUP in userform
    By Hond70 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-25-2011, 07:32 AM
  6. UserForm VLOOKUP
    By tim_chisman in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-09-2010, 05:27 AM
  7. Vlookup in a userform
    By R D S in forum Excel General
    Replies: 6
    Last Post: 01-26-2005, 06:06 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