+ Reply to Thread
Results 1 to 12 of 12

VBA Userform - Lookup/Match Textbox values to prefill other Textbox values

  1. #1
    Registered User
    Join Date
    11-07-2018
    Location
    Sydney Australia
    MS-Off Ver
    2016 Pro
    Posts
    74

    VBA Userform - Lookup/Match Textbox values to prefill other Textbox values

    Hi All,

    I have a simple userform, which I want to use the values entered in TextBoxMin and TextBoxDOB to lookup my Spreadsheet Range (C3:I12) and return the corresponding values to populate TextboxName, TextBoxCS, TextBoxCP, TextBoxSS, TextBoxDate.

    For Example:

    If the user filled in MIN and DOB, Afterupdate() would vlookup the spreadsheet Range(C3:I12), then and populate Name, Current Hospital, Current Position, Subspecialty and Date. i.e Min1 and Dob1 = Name1, Hospital1, Position1, Subspecialty1, Date1.

    I have attached my workbook.

    I attempted and failed and searched forums and google, but unfortunately not having much luck. Any help would be great!!

    Please Login or Register  to view this content.

    Cheers

    <Not listed on any other forums>
    Attached Files Attached Files
    Last edited by Lee_of_Excel; 02-20-2020 at 09:25 PM.

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: VBA Userform - Lookup/Match Textbox values to prefill other Textbox values

    Try something like
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    11-07-2018
    Location
    Sydney Australia
    MS-Off Ver
    2016 Pro
    Posts
    74

    Re: VBA Userform - Lookup/Match Textbox values to prefill other Textbox values

    Awesome again Jindon, I hope that I'll be able to repay all of your assistance soon.

    Thanks again, cheers

  4. #4
    Registered User
    Join Date
    11-07-2018
    Location
    Sydney Australia
    MS-Off Ver
    2016 Pro
    Posts
    74

    Re: VBA Userform - Lookup/Match Textbox values to prefill other Textbox values

    Quote Originally Posted by jindon View Post
    Try something like
    Hi Jindon,

    I am now trying to make a dynamic list using 2 Combo Boxes,

    How should I modify the code so that when a user selects a value from ComboBox3 drop down (which is using
    Please Login or Register  to view this content.
    ) , it will populate the second Combox (ComboBox4)with the vlookup values from range P3:P410?

    I tried to modify your original code, but I can't seem to get it to work.

    Cheers

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: VBA Userform - Lookup/Match Textbox values to prefill other Textbox values

    Sorry, but I don't understand what you are trying to do.
    Is it related to your original question?

  6. #6
    Registered User
    Join Date
    11-07-2018
    Location
    Sydney Australia
    MS-Off Ver
    2016 Pro
    Posts
    74

    Re: VBA Userform - Lookup/Match Textbox values to prefill other Textbox values

    Apologies, I did not explain correctly.

    It is related to the original question, but I am trying to lookup a whole range now instead of just 1 value.

    For Example, In the attached workbook I have 2 Ranges of Data in Range 1 and Range 2 of Sheet1.

    The Userform has 2 ComboBoxes and a TextBox.

    ComboBox1 Should show the full list (without duplicates) from Range 1, but ComboBox2 should only show results based on what the user chooses in ComboBox1.

    e.g. If the user chooses Lookup 1 in ComboxBox1 then ComboBox 2 should show only Result 1,2,3,4 and 5 to choose from.

    Range 1 Range 2
    Lookup 1 Result 1
    Lookup 1 Result 2
    Lookup 1 Result 3
    Lookup 1 Result 4
    Lookup 1 Result 5
    Lookup 2 Result 6
    Lookup 2 Result 7
    Lookup 2 Result 8
    Lookup 2 Result 9
    Lookup 2 Result 10
    Lookup 2 Result 11
    Lookup 5 Result 12
    Lookup 5 Result 13
    Lookup 5 Result 14
    Lookup 5 Result 15

    I then want to publish the result of ComboBox2 in TextBox1.

    I tried to modify your first solution, but I keep getting errors and I am a bit stuck.

    Hopefully this makes better sense.
    Attached Files Attached Files

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: VBA Userform - Lookup/Match Textbox values to prefill other Textbox values

    OK,
    I need to go out now, so I'll have a look at it later.

  8. #8
    Registered User
    Join Date
    11-07-2018
    Location
    Sydney Australia
    MS-Off Ver
    2016 Pro
    Posts
    74

    Re: VBA Userform - Lookup/Match Textbox values to prefill other Textbox values

    Ok thanks,

    Cheers

  9. #9
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: VBA Userform - Lookup/Match Textbox values to prefill other Textbox values

    To UserForm1 code module
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    11-07-2018
    Location
    Sydney Australia
    MS-Off Ver
    2016 Pro
    Posts
    74

    Re: VBA Userform - Lookup/Match Textbox values to prefill other Textbox values

    Works great! thanks very much yet again Jindon! :-D

  11. #11
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: VBA Userform - Lookup/Match Textbox values to prefill other Textbox values

    If that takes care of your original question, select Thread Tools from the menu link above and mark this thread as SOLVED.

  12. #12
    Registered User
    Join Date
    11-07-2018
    Location
    Sydney Australia
    MS-Off Ver
    2016 Pro
    Posts
    74

    Re: VBA Userform - Lookup/Match Textbox values to prefill other Textbox values

    Quote Originally Posted by jindon View Post
    If that takes care of your original question, select Thread Tools from the menu link above and mark this thread as SOLVED.
    Done, Cheers :-D

+ 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. [SOLVED] lookup & match values from userform & insert text from textbox
    By Jamesraywebber85 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-10-2020, 12:47 AM
  2. [SOLVED] Lookup value one TextBox and paste value of another TextBox if there is a Match
    By rakotonirinas in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-11-2019, 06:50 PM
  3. 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
  4. [SOLVED] Add UserForm textbox values
    By mkachwee in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-07-2012, 10:13 AM
  5. 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
  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