• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Auto Fill Userform TextBox when a value is selected in ComboBox

guirmaia

New Member
Hello everyone,
I want to autofill a text box in a userform when i select a value from the combobox.
We have a table with two columns with values, for example, if i select 1100 in combobox, in textbox W need to appear 1200!
Names:
Combobox1
Textbox3

Best regards,
Guilherme
 

Attachments

  • Captura de ecrã 2022-05-02 140025.png
    Captura de ecrã 2022-05-02 140025.png
    9.4 KB · Views: 18
  • Captura de ecrã 2022-05-02 140115.png
    Captura de ecrã 2022-05-02 140115.png
    6.9 KB · Views: 18
1. Set up your Combobox1 as follows.
78745

This will set up combobox with 2 columns. But only display 1st column value.
I don't know how you are loading data to your combobox. But load both columns as one.

2. Then using Combobox1_Change() event. Retrieve and set Textbox3 value.
Note: Column(1) = second column. As it uses 0 base index.
Ex:
Code:
Private Sub ComboBox1_Change()
TextBox3.Value = ComboBox1.Column(1)
End Sub
 
Back
Top