+ Reply to Thread
Results 1 to 7 of 7

UserForm Auto populating data from a worksheet

  1. #1
    Registered User
    Join Date
    11-06-2012
    Location
    Sydney
    MS-Off Ver
    Excel 2003
    Posts
    32

    UserForm Auto populating data from a worksheet

    Hi Guys,

    I've done a little research and I can't seem to find anythign that helps. Here's the situation:

    I have 7 textboxes (TextBox1 - TextBox7), I also have a hidden sheet that has a nominal roll of shorts with 7 columns worth of pers data.

    What I would like to happen is when the member's employee number is typed into the userform, it auto populates the other 6 textboxes from the worksheet with the pers data.

    This is the code I have so far for what I want it to do besides the above:

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: UserForm Auto populating data from a worksheet

    Hi Rob (great name btw),

    I have coded the following to a command button called cmdOK, use it for whatever your button is called:

    Please Login or Register  to view this content.
    Regards,

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  3. #3
    Registered User
    Join Date
    11-06-2012
    Location
    Sydney
    MS-Off Ver
    Excel 2003
    Posts
    32

    Re: UserForm Auto populating data from a worksheet

    Hi Robert! (Completely agree with the name btw!)

    Fantastic bit of code, trying to reverse engineer it so I can learn it! Thank you so much! If I could ask, how could I ammend this to automate the process once you tab or click out of the textbox?

    Cheers,

    Rob.

  4. #4
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: UserForm Auto populating data from a worksheet

    Though you could probably do this via an event macro on TextBox1, why not change the control to a listbox so the user can only select the surnames which will both save on time (no data entry) and eliminate errors?

    Let me know if you have trouble with this as I'll post an example as to how it would work.

    Cheers,

    Robert
    Last edited by Trebor76; 05-04-2015 at 10:33 PM.

  5. #5
    Registered User
    Join Date
    11-06-2012
    Location
    Sydney
    MS-Off Ver
    Excel 2003
    Posts
    32

    Re: UserForm Auto populating data from a worksheet

    There will be 800 + entries with the addition of another userform designed to add entries.

    How would the Event macro look?

    Cheers,

    Rob.

  6. #6
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: UserForm Auto populating data from a worksheet

    There will be 800 + entries with the addition of another userform designed to add entries.
    Even more reason to have a listbox in my humble opinion. This method would also overcome the situation of having the same surname multiple times whereas the above will only select the first match it finds as it's based on a standard VLOOKUP function. A listbox also has intellisense.

    In any case, you can use the following to run the above procedure once textbox1 is tabbed out of:

    Please Login or Register  to view this content.
    Regards,

    Robert
    Last edited by Trebor76; 05-04-2015 at 11:08 PM.

  7. #7
    Registered User
    Join Date
    11-06-2012
    Location
    Sydney
    MS-Off Ver
    Excel 2003
    Posts
    32

    Re: UserForm Auto populating data from a worksheet

    I'll have a play around with both and see how it feels!

    Thanks again for your help. I'm having issues with the website, when I get home I'll add to your rep!

    Appreciate it!

    Rob.

+ 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. Populating Userform data to another worksheet
    By BigSpeekaz in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-13-2014, 04:14 AM
  2. Auto populating combo box on userform with filtered range
    By Serapiace in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-20-2014, 10:23 PM
  3. auto populating a row that uses data from another worksheet's column
    By boxofrain in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 12-30-2013, 02:24 PM
  4. Auto-populating data from one worksheet to another
    By cpeske in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-08-2010, 04:44 PM
  5. [SOLVED] Auto populating UserForm Combo and Text boxes from Validated data sets
    By ZIXILPLIX in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-04-2010, 12:55 AM

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