+ Reply to Thread
Results 1 to 2 of 2

Trying to Link 2 textboxs to a combobox selection

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    06-06-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    181

    Trying to Link 2 textboxs to a combobox selection

    Hi All,

    I have created a simple table and I am trying to link the 2 textboxes to the select from the combobox so when a selection is made the textbox1 and textbox2 will automatically populate. Attached is the code I have tried to use but doesn't work. Any ideas?

    Option Explicit
    Private Sub ComboBox1_Change()
    
    ' Declare the values
    Dim fruit As String
    Dim findValue As Range
    
    ' Set the search range
    Set findValue = Sheet1.Range("B:B").Find(What:=fruit, LookIn:=xlValues)
    
    ' Link the active cell with the fruit and offset twice, then link offset to textboxs
    Me.ComboBox1.Value = findValue
    Me.TextBox1.Value = findValue.Offset(0, 1).Value
    Me.TextBox2.Value = findValue.Offset(0, 2).Value
    
    End Sub

  2. #2
    Forum Contributor
    Join Date
    06-06-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    181

    Re: Trying to Link 2 textboxs to a combobox selection

    Found the answer:

    Option Explicit
    Private Sub ComboBox1_Change()
    
    ' Declare the values
    Dim fruit As String
    Dim findValue As Range
    
    fruit = ComboBox1.Value
    
    ' Set the search range
    Set findValue = Sheet1.Range("B:B").Find(What:=fruit, LookIn:=xlValues)
    
    ' Link the active cell with the fruit and offset twice, then link offset to textboxs
    Me.ComboBox1.Value = findValue.Value
    Me.TextBox1.Value = findValue.Offset(0, 1).Value
    Me.TextBox2.Value = findValue.Offset(0, 2).Value
    
    End Sub

+ 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. Populating Combobox based on Combobox selection from EXCEL worksheet
    By JChaney17 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 08-04-2014, 08:14 AM
  2. Mail from userform in excel, content from textboxs and combobox
    By perkb in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 11-26-2013, 01:25 PM
  3. [SOLVED] Make combobox list options dependant on selection in another combobox within a userform
    By Vladimir_Dobvchenko in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-23-2013, 05:30 AM
  4. [SOLVED] fill combobox selection based on a selection from the first combobox
    By Monza in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-14-2013, 07:34 PM
  5. Populating textboxs with resultsof combobox choice
    By Lensmeister in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-19-2012, 10:27 AM

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