+ Reply to Thread
Results 1 to 7 of 7

Excel Userform: Populate other controls (i.e. textbox & combobox) based on combobox select

  1. #1
    Registered User
    Join Date
    01-20-2013
    Location
    Denver, Colorado
    MS-Off Ver
    2011 (mac)
    Posts
    48

    Excel Userform: Populate other controls (i.e. textbox & combobox) based on combobox select

    Hi There, I'm trying to create a userform that will allow one to select a subject from a combobox and populate the remaining controls with data from the corresponding spreadsheet. Here's the code I've been trying with no success:

    Please Login or Register  to view this content.
    Attached is a simplified version of the .xlsm I'm working with....Any suggestions on how to make this work?
    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,643

    Re: Excel Userform: Populate other controls (i.e. textbox & combobox) based on combobox se

    Try this.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    01-20-2013
    Location
    Denver, Colorado
    MS-Off Ver
    2011 (mac)
    Posts
    48

    Re: Excel Userform: Populate other controls (i.e. textbox & combobox) based on combobox se

    That worked beautifully! I understand why it says "Forum Guru" by your name.... Thanks!

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,532

    Re: Excel Userform: Populate other controls (i.e. textbox & combobox) based on combobox se

    Just want to add that the reason that solution worked is that you do not have the RowSource property of the combobox set. You are instead loading the elements in the code in UserForm_Initialize. If you had been using RowSource then your code would have worked.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  5. #5
    Registered User
    Join Date
    01-20-2013
    Location
    Denver, Colorado
    MS-Off Ver
    2011 (mac)
    Posts
    48

    Re: Excel Userform: Populate other controls (i.e. textbox & combobox) based on combobox se

    Thanks for the additional info 6String!

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

    Re: Excel Userform: Populate other controls (i.e. textbox & combobox) based on combobox se

    Actually, there was another tiny fix needed.

    The combobox wasn't called ComboBox1, it was cboStudyID.

  7. #7
    Registered User
    Join Date
    01-20-2013
    Location
    Denver, Colorado
    MS-Off Ver
    2011 (mac)
    Posts
    48

    Re: Excel Userform: Populate other controls (i.e. textbox & combobox) based on combobox se

    Indeed, it was.... good eyes, Norie!

+ 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