Results 1 to 7 of 7

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

Threaded View

MileHigh_PhD Excel Userform: Populate... 01-22-2013, 11:17 AM
Norie Re: Excel Userform: Populate... 01-22-2013, 11:47 AM
MileHigh_PhD Re: Excel Userform: Populate... 01-22-2013, 12:13 PM
6StringJazzer Re: Excel Userform: Populate... 01-22-2013, 02:21 PM
MileHigh_PhD Re: Excel Userform: Populate... 01-22-2013, 04:44 PM
Norie Re: Excel Userform: Populate... 01-22-2013, 04:49 PM
MileHigh_PhD Re: Excel Userform: Populate... 01-22-2013, 04:50 PM
  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:

    Private Sub cboStudyID_Change()
        'populate data on userform based on StudyID selection
        Dim strNamedRange As String
        Dim lRelativeRow As Long
         
        With ComboBox1
            If .ListIndex > -1 Then
                strNamedRange = .RowSource
                 'ListIndex starts at zero
                lRelativeRow = .ListIndex + 1
                 'Fill with adjacent column to Combobox choice
                txtEnrollmentDate = Range(strNamedRange)(lRelativeRow, 2)
                 'Fill with 2nd adjacent column to Combobox choice
                cboSite = Range(strNamedRange)(lRelativeRow, 3)
                 'Fill with 3rd adjacent column to Combobox choice
                cboRetention = Range(strNamedRange)(lRelativeRow, 4)
            End If
        End With
        
    
    End Sub
    Attached is a simplified version of the .xlsm I'm working with....Any suggestions on how to make this work?
    Attached Files Attached Files

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