p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Excel VBA (http://p2p.wrox.com/forumdisplay.php?f=79)
-   -   Userform (http://p2p.wrox.com/showthread.php?t=84850)

pescioletto August 25th, 2011 10:50 AM

Userform
 
Hi,

I have following data in cells A2:D12 in Sheet2

category fruit number colour
a apples 10 red
b pears 12 green
c apples 5 green
d bananas 4 yellow
e apples 9 red
f bananas 7 yellow
g apples 8 red
h cherries 2 red
i bananas 3 yellow
j cherries 2 red

I would like to create a Useform in Sheet2 so that when I put fruit name in textbox eg. apples then I click command button I get in Sheet1 (starting from Cell A1) the list of numbers for that specific fruit. So if I put apples I would get 10, 5, 9, 8.

How do I do that?

Thanks,
P. [:confused:]

Shasur August 26th, 2011 03:01 AM

Hi

If it is a direct table you could have linked your textbox to the excel file using Controlsource property. Since you have multiple values for an entry, you need to manipulate this yourself with VBA code.

You can write the logic in the Change event of the textbox

Cheers
Shasur

Shasur August 26th, 2011 03:03 AM

You can also try using the sheet as a data source and querying for the product. The following links might help you

http://vbadud.blogspot.com/2008/05/u...-database.html

Cheers
Shasur

pescioletto September 5th, 2011 10:26 AM

Thanks,

[:)]


All times are GMT -4. The time now is 06:53 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.