vendredi 29 avril 2016

how to fill a combobox in a userform using vlookup of the values inserted in other comboboxes?

I have a table where I have for each month the type of shrimp and quantity caught and also the weight of each type of shrimp. In the first column of this table, I'm concatenating the shrimptype and the quantity.

So using a userform, I want that once the user chooses the shrimp type from a combobox list "shrimptype"(cbshrimptype) and quantity "700" in a textbox (tbquantity),

I want that the combobox of the shrimp weight takes the value that corresponds to shrimptype700 already concatenated in the table described above, and that exists in the 7th column of the table. (chshrimptype is a checkbox) That's the code that I tried and that didn't work:

If chshrimptype.Value = True Then Me.cbshrimpweight.Text = Application.WorksheetFunction.VLookup((Me.cbshrimptype.Text & Me.tbquantity.Text), Worksheets("Table").Range("shrimp"), 7, False) End If

Thank you so much for your help !




Aucun commentaire:

Enregistrer un commentaire