Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 25th, 2011, 10:50 AM
Registered User
Points: 20, Level: 1
Points: 20, Level: 1 Points: 20, Level: 1 Points: 20, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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.
Reply With Quote
  #2 (permalink)  
Old August 26th, 2011, 03:01 AM
Friend of Wrox
Points: 3,060, Level: 23
Points: 3,060, Level: 23 Points: 3,060, Level: 23 Points: 3,060, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: , , .
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)
Reply With Quote
  #3 (permalink)  
Old August 26th, 2011, 03:03 AM
Friend of Wrox
Points: 3,060, Level: 23
Points: 3,060, Level: 23 Points: 3,060, Level: 23 Points: 3,060, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: , , .
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)
Reply With Quote
The Following User Says Thank You to Shasur For This Useful Post:
pescioletto (September 5th, 2011)
  #4 (permalink)  
Old September 5th, 2011, 10:26 AM
Registered User
Points: 20, Level: 1
Points: 20, Level: 1 Points: 20, Level: 1 Points: 20, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2011
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thanks,

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


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



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


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