+ Reply to Thread
Results 1 to 15 of 15

Userform cannot display info for two surnames that is the same from dropdownlist

  1. #1
    Forum Contributor
    Join Date
    09-03-2008
    Location
    Johannesburg, South Africa
    MS-Off Ver
    2021
    Posts
    351

    Userform cannot display info for two surnames that is the same from dropdownlist

    I using this code to get data from dropdown list

    But if I have two surnames that is the same, I cannot get it to show the correct data from each same surname, it show the first name of the first person of the first same surname.

    So if say if the first same surname is Pienaar with two names (Piet and Sannie) and second same surname with two names (Jaapie and Sarie, so when I choose any same surname it show 3 names showing (Piet, Sannie and Jaapie).
    only happening with same surname. It must show only the name or names of each same surname.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by hendrikbez; 04-10-2024 at 12:37 PM.

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

    Re: Userform cannot display info for two surnames that is the same from dropdownlist

    What happened to your previous thread.

    https://www.excelforum.com/excel-pro...ml#post5938072

  3. #3
    Forum Contributor
    Join Date
    09-03-2008
    Location
    Johannesburg, South Africa
    MS-Off Ver
    2021
    Posts
    351

    Re: Userform cannot display info for two surnames that is the same from dropdownlist

    Did close the one, but this is an different problem

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,306

    Re: Userform cannot display info for two surnames that is the same from dropdownlist

    In your previous thread, you said this:

    Thank you, will look at this
    That was your last post - you never came back and said whether or not you'd made it work. Members put a lot of effort into helping you, so you should make an effort to ensure that you keep them fully informed. Just marking the thread as SOLVED is not really enough from the point of view of courtesy.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,693

    Re: Userform cannot display info for two surnames that is the same from dropdownlist

    Your code does not take into account that the VAN only appears on the FIRST line so with multiple children it skips all but the first (in column D).

    Hence for Pienaar you will select Louis and Michelle and omit Mari.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  6. #6
    Forum Contributor
    Join Date
    09-03-2008
    Location
    Johannesburg, South Africa
    MS-Off Ver
    2021
    Posts
    351

    Re: Userform cannot display info for two surnames that is the same from dropdownlist

    Yes, My fault, I did not update, it, and did thank the people that help me. I did get help from somewhere ells with it, as the asters did not help, and I was told not to ask any more than 1 a day, so after your message, I did not get any more info on that problem

  7. #7
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,410

    Re: Userform cannot display info for two surnames that is the same from dropdownlist

    As John Topley has pointed out - with missing data you will miss out those with blank fields - you need to re-structure your data so that blank surnames are filled.
    I have attached a sample - note the last two rows have common surname with differing first names - if you pick search on surname a single choice is available in combobox - however choosing this will give you both entry choices in the listbox.
    Attached Files Attached Files
    Torachan,

    Mission statement; Promote the use of Tables, Outlaw the use of 'merged cells' and 'RowSource'.

  8. #8
    Forum Contributor
    Join Date
    09-03-2008
    Location
    Johannesburg, South Africa
    MS-Off Ver
    2021
    Posts
    351

    Re: Userform cannot display info for two surnames that is the same from dropdownlist

    Thank you , will look and see if this will work for me, will let you know.

    Looking at this, it is more difficult that I know, I am not that good in excel vb yet.

    Wil take me a while to try to understand what the code is doing so I can use it
    Last edited by hendrikbez; 04-10-2024 at 08:27 AM.

  9. #9
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,410

    Re: Userform cannot display info for two surnames that is the same from dropdownlist

    My apologises - I attached the wrong app - although very similar the more useful is attached.
    Also attached a PDF of the code - this format is easier to follow as it shows the structure (loops etc).
    I leave all the controls (textboxes,labels,comboboxes) with their default names - you can loop through them with 3 or 4 rows of code rather then individually naming and reference each which saves many rows of code in a large app.
    Attached Files Attached Files

  10. #10
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    2,957

    Re: Userform cannot display info for two surnames that is the same from dropdownlist

    I might be missing something but the userform seems to cater for a max of 5 people with the same surname but the sheet has more than 5 people with the same surname, e.g. "Venter".

    Anyway, you could try the following changes in the Userform code.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    09-03-2008
    Location
    Johannesburg, South Africa
    MS-Off Ver
    2021
    Posts
    351

    Re: Userform cannot display info for two surnames that is the same from dropdownlist

    Thank you for reply
    The 5 is just in case a family that could have 5 members. The one you are talking about is 3 different families that have the same surname ( that is what I am trying to get to work to show each family separated by choose them on dropdown with surname. So if I have 3 Venter in dropdown, I want to click on any one of the three and it must show me all the members of that family in my form

  12. #12
    Forum Contributor
    Join Date
    09-03-2008
    Location
    Johannesburg, South Africa
    MS-Off Ver
    2021
    Posts
    351

    Re: Userform cannot display info for two surnames that is the same from dropdownlist

    Thank you, busy reading true it, to see how it works

  13. #13
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    2,957

    Re: Userform cannot display info for two surnames that is the same from dropdownlist

    Does this work for you?
    I added a hidden combobox for the ID of the surnames.
    Attached Files Attached Files
    Last edited by ByteMarks; 04-11-2024 at 04:11 AM.

  14. #14
    Forum Contributor
    Join Date
    09-03-2008
    Location
    Johannesburg, South Africa
    MS-Off Ver
    2021
    Posts
    351

    Re: Userform cannot display info for two surnames that is the same from dropdownlist

    ByteMarks. Thank you, Yes this is what I needed.
    Thank you for every one that try to help me

  15. #15
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    2,957

    Re: Userform cannot display info for two surnames that is the same from dropdownlist

    You're welcome.

+ 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. Can't assign numeric value to UserForm ComboBox with DropDownList Style
    By Greg M in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-14-2021, 06:15 AM
  2. To make a Dynamic Search DropDownList in UserForm.ComboBox
    By gnaske in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 09-08-2015, 05:56 PM
  3. [SOLVED] VBA Line to Send Userform Info to Parent Userform Textbox
    By excelforumkeys in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-01-2014, 04:28 PM
  4. display autoffiltered info from closed workbook in userform
    By Jarko28 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-14-2013, 12:28 PM
  5. [SOLVED] Open a userform from a userform, but preserve the info in the original userform
    By jfoerch in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-25-2013, 02:38 PM
  6. Replies: 1
    Last Post: 11-29-2012, 09:58 AM
  7. Textboxes within Userform to display info based on combobox selection
    By alter54 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-28-2012, 12:40 PM

Tags for this Thread

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