Wrox Programmer Forums
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 25th, 2011, 10:50 AM
Registered User
 
Join Date: Aug 2011
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default 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.
 
Old August 26th, 2011, 03:01 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

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
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
 
Old August 26th, 2011, 03:03 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

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
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
The Following User Says Thank You to Shasur For This Useful Post:
pescioletto (September 5th, 2011)
 
Old September 5th, 2011, 10:26 AM
Registered User
 
Join Date: Aug 2011
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thanks,






Similar Threads
Thread Thread Starter Forum Replies Last Post
modeless userform randomwanderer Excel VBA 3 December 3rd, 2008 08:59 AM
Excel UserForm ttitto Excel VBA 0 December 11th, 2007 12:20 PM
Userform - Modeless chrislim1 Excel VBA 10 September 20th, 2006 12:36 PM
Remove UserForm lostthought Excel VBA 0 July 29th, 2004 12:47 PM
Surface in a userform Rosser VB How-To 0 March 31st, 2004 06:07 AM





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