Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Userform question Brad Excel Discussion (Misc queries) 4 March 15th 10 04:43 PM
Question regarding UserForm TotallyConfused Excel Discussion (Misc queries) 0 September 3rd 09 09:38 PM
Userform question ub Excel Discussion (Misc queries) 0 February 19th 09 06:56 PM
Userform question Anthony Excel Worksheet Functions 4 June 27th 08 04:26 PM
Another Userform question. ingleg Excel Discussion (Misc queries) 1 July 6th 06 01:17 PM


All times are GMT +1. The time now is 10:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"