+ Reply to Thread
Results 1 to 3 of 3

Userform Combobox selection populates wrong data in the textboxes

  1. #1
    Registered User
    Join Date
    08-09-2010
    Location
    Riyad
    MS-Off Ver
    Excel 2007
    Posts
    2

    Userform Combobox selection populates wrong data in the textboxes

    Hi

    I have a userform with several textboxes and a combobox. The combobox list is sorted alphabetically by a code, while the worksheet is not. I am using the change event of the combobox to populate the textboxes with the values from the worksheet, based on the combobox value. However, the textboxes are not populated properly. I am sure that there is something wrong with my code, which I can't rectify. Please help. The file is attached.
    Attached Files Attached Files

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Userform Combobox selection populates wrong data in the textboxes

    Since you've sorted the data in the combobox you can't use it's ListIndex to find the row of data you want.

    You'll need some other method.

    Try this which works with your sample data as long as you change the BoundColumn of cboFirstname to 1.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    08-09-2010
    Location
    Riyad
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Userform Combobox selection populates wrong data in the textboxes

    Dear Norie
    It's working perfectly. Thank a lot.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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