• 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.

Userform vlookup multiple criteria

Rodrigues

Member
Hi there, I'm working on a userform with multiple combobox's and textbox's. Would like to know that, if it is possible to have a vlookup for the following:
When a selection has been made on comboBox1 and on comboBox2 the TextBox1 will display the respective value found on defined name list "Products".
Example:
ComboBox1: C
ComboBox2: 31
to be displayed on TextBox1: 300
File attached for better illustration.
Any help will be appreciated.
Thanks in advance.
Rodrigues
 

Attachments

  • Book1.xlsm
    20 KB · Views: 39
One way
Code:
Private Sub ComboBox1_Change()
    Me.TextBox1.Value = ""
    If (Me.ComboBox1.ListIndex < 0) + (Me.ComboBox2.ListIndex < 0) Then Exit Sub
    myLookUp
End Sub

Private Sub ComboBox2_Change()
    Me.TextBox1.Value = ""
    If (Me.ComboBox1.ListIndex < 0) + (Me.ComboBox2.ListIndex < 0) Then Exit Sub
    myLookUp
End Sub

Private Sub myLookUp()
    Me.TextBox1.Value = Sheets("products").ListObjects("table1").DataBodyRange.Cells(Me.ComboBox1.ListIndex + 1, Me.ComboBox2.ListIndex + 2)
End Sub
 
Back
Top