+ Reply to Thread
Results 1 to 5 of 5

Update textbox based on ComboBox

Hybrid View

  1. #1
    Registered User
    Join Date
    11-22-2008
    Location
    house
    Posts
    68

    Update textbox based on ComboBox

    Hi there

    I have a macro which updates a textbox based on the selelction in the combobox. The macro is currently set up to change the textbox on "worksheet change" which means I can only make the text box update by altering the worksheet after making the selection on the combobox.

    Eg, make selection from combobox, however this makes no change to the textbox. So, I need to then double clicking into a cell then pressing enter for example which then updates the text box.

    Is there a line of code I can use to make the textbox update as soon as the user makes a selection from the comobobox.

    Private Sub Worksheet_Change(ByVal Target As Range)
                
        If ComboBox1.Value = "Product1" Then
        
        ActiveSheet.Shapes("textbox1").Select
        Selection.Characters.Text = _
            "Product 1 Causes.....etc"
             
        End If
    Thanks

  2. #2
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Update textbox based on ComboBox

    Hello.

    Using controlls on the sheet should be easer using active x controls.

    place the two active x controlls on the sheet and try this code.
    Private Sub ComboBox1_Change()
        Select Case ComboBox1.Value
            Case Is = "Product1"
                TextBox1.Value = "Product 1 Causes.....etc"
            Case Is = "Product2"
                TextBox1.Value = "Product 2 Causes"
            Case Else
                TextBox1.Value = ""
        End Select
    End Sub
    cheers


  3. #3
    Registered User
    Join Date
    11-22-2008
    Location
    house
    Posts
    68

    Re: Update textbox based on ComboBox

    Hi there, thanks for the reply

    What do you mean by active x controls/place two active x controls on the sheet?

    Thanks

  4. #4
    Registered User
    Join Date
    11-22-2008
    Location
    house
    Posts
    68

    Re: Update textbox based on ComboBox

    hi again,

    do you mean using a combo box from the "control toolbax" instead of "forms"? If so, I am not very good with these and don't even know how to add items to the dropdown list. any help would be great

    thanks again

  5. #5
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Update textbox based on ComboBox

    in x 2007 on the developer ribbon cilck insert and under the heading active x insert the combobox.

    then its just like using then in a userform.
    using the drop button click event
    Private Sub ComboBox1_DropButtonClick()
    'ComboBox1.List = Array("itemone", "Itntho", "asfd")
    'ComboBox1.List = Range("A1:A10").Value
    End Sub
    hope this helps
    cheers

+ 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