PDA

View Full Version : Solved: userform to search datasheet & return values



jazznaura
03-20-2008, 07:55 AM
Hi all,
I new to VBA and this is my first attempt at using a userform.
What I’m trying to do is create a userform where you enter a product number and when you press search, returns all the info about that product. There are probably better ways/applications for doing this, but this is just an exercise to help me learn userforms.
I created the userform but don’t know where to start with the coding. What I want to do is enter the product number (called Tpnd) in the list box and then press search to have it search through column A in the data sheet, find the number and return the relevant data in each column, to the relevant textbox on the userform.
I’m not sure this is an appropriate use for userforms , but any advice or a point in the right direction would be appreciated.
Attached spreadsheet.

thanks

jazz naura

mdmackillop
03-20-2008, 08:42 AM
Use a Combobox instead of a listbox
Use meaningful names for your controls
If the user is not to enter data, consider using formatted labels, rather than textboxes to display results. Use textboxes where you want changes to be transferred back to the Data sheet.

This sample populates the first textbox, but the principle is simple.

jazznaura
03-20-2008, 12:11 PM
thanks mdmackillop,

thats just the pointer i needed.

regards
jazz naura