Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
userform question
Hi David,
Assuming your list of product codes and descriptions is located in range A1:B5 on Sheet1, the following code should do what you want: Private Sub ListBox1_Change() TextBox1.Text = Application.VLookup(ListBox1.Text, _ Sheet1.Range("A1:B5"), 2, False) End Sub Note that if your product codes are numeric, you'll need to cast the ListBox.Text value into a numeric value using something like CLng(). -- Rob Bovey, MCSE, MCSD, Excel MVP Application Professionals http://www.appspro.com/ * Please post all replies to this newsgroup * * I delete all unsolicited e-mail responses * "David Goodall" wrote in message ... Hi All, I have a worksheet that contains product codes (column A) and product descriptions (column B). I designed a userform which includes a list box which has all the product codes in it. I used the rowsource property to populate it. I would like a text box on the userform automatically completed when the product code is chosen in the list box. Is this possible? I have some programming experience but only in C++. I'm new too VB so forgive me if this is a silly question. Thanks David |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Userform question | Excel Discussion (Misc queries) | |||
Question regarding UserForm | Excel Discussion (Misc queries) | |||
Userform question | Excel Discussion (Misc queries) | |||
Userform question | Excel Worksheet Functions | |||
Another Userform question. | Excel Discussion (Misc queries) |